SVK likes to begin all commit messages with a line of the format: r12345@hostname: user | YYYY-MM-DD HH:MM:SS -ZZZZ which makes the import desperately ugly in git. This adds a -k option to move this extra SVK commit line to the end of the commit message, rather than keeping it at the beginning. --- Documentation/git-svnimport.txt | 6 +++++- git-svnimport.perl | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt index e97d15e..23a54b0 100644 --- a/Documentation/git-svnimport.txt +++ b/Documentation/git-svnimport.txt @@ -11,7 +11,7 @@ SYNOPSIS -------- [verse] 'git-svnimport' [ -o <branch-for-HEAD> ] [ -h ] [ -v ] [ -d | -D ] - [ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_rev] + [ -C <GIT_repository> ] [ -i ] [ -k ] [ -u ] [-l limit_rev] [ -b branch_subdir ] [ -T trunk_subdir ] [ -t tag_subdir ] [ -s start_chg ] [ -m ] [ -r ] [ -M regex ] [ -I <ignorefile_name> ] [ -A <author_file> ] @@ -68,6 +68,10 @@ When importing incrementally, you might need to edit the .git/svn2git file. Prepend 'rX: ' to commit messages, where X is the imported subversion revision. +-k:: + Remove SVK-style revision/commiter info from the top of commit + messages and move it to the bottom. + -I <ignorefile_name>:: Import the svn:ignore directory property to files with this name in each directory. (The Subversion and GIT ignore diff --git a/git-svnimport.perl b/git-svnimport.perl index f459762..7076f41 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -32,20 +32,20 @@ $ENV{'TZ'}="UTC"; our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T, $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F, - $opt_P,$opt_R); + $opt_P,$opt_R,$opt_k); sub usage() { print STDERR <<END; Usage: ${\basename $0} # fetch/update GIT from SVN [-o branch-for-HEAD] [-h] [-v] [-l max_rev] [-R repack_each_revs] [-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname] - [-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg] + [-d|-D] [-i] [-k] [-u] [-r] [-I ignorefilename] [-s start_chg] [-m] [-M regex] [-A author_file] [-S] [-F] [-P project_name] [SVN_URL] END exit(1); } -getopts("A:b:C:dDFhiI:l:mM:o:rs:t:T:SP:R:uv") or usage(); +getopts("A:b:C:dDFhiI:kl:mM:o:rs:t:T:SP:R:uv") or usage(); usage if $opt_h; my $tag_name = $opt_t || "tags"; @@ -835,7 +835,19 @@ sub commit { $pw->writer(); $pr->reader(); + + if ( $opt_k ) { + # Remove SVK cruft in commit message + my ($svk_info) = $message =~ s{(r\d+\@[^:]+:\s+\S+\s+\|\s+\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2}\s[\+-]\d{4})\s*}{}; + if( $svk_info ) { + # and stick it on the end so we don't lose it + $message .= "\n$svk_info" + } + } + + $message =~ s/[\s\n]+\z//; + $message = "r$revision: $message" if $opt_r; print $pw "$message\n" -- 1.5.2.2.239.g89630 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html