git-svnimport: -r adds svn revision number to commit messages
New -r flag for prepending the corresponding Subversion revision number to each commit message. Signed-off-by: Karl Hasselström <kha@treskal.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Karl Hasselström committed
Feb 14, 2006 at 03:43 UTC
0a48a344c6a886fee7f4e6d88e8ac5d5317ad8eb
2 files changed
+8
-3
Documentation/git-svnimport.txt
+4
@@ -61,6 +61,10 @@ When importing incrementally, you might need to edit the .git/svn2git file.
61
the git repository. Use this option if you want to import into a
62
different branch.
63
64
+-r::
65
+ Prepend 'rX: ' to commit messages, where X is the imported
66
+ subversion revision.
67
+
68
-m::
69
Attempt to detect merges based on the commit message. This option
70
will enable default regexes that try to capture the name source
git-svnimport.perl
+4
-3
@@ -30,19 +30,19 @@ die "Need SVN:Core 1.2.1 or better" if $SVN::Core::VERSION lt "1.2.1";
30
$SIG{'PIPE'}="IGNORE";
31
$ENV{'TZ'}="UTC";
32
33
-our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_s,$opt_l,$opt_d,$opt_D);
33
+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_s,$opt_l,$opt_d,$opt_D);
34
35
sub usage() {
36
print STDERR <<END;
37
Usage: ${\basename $0} # fetch/update GIT from SVN
38
[-o branch-for-HEAD] [-h] [-v] [-l max_rev]
39
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
40
- [-d|-D] [-i] [-u] [-s start_chg] [-m] [-M regex] [SVN_URL]
40
+ [-d|-D] [-i] [-u] [-r] [-s start_chg] [-m] [-M regex] [SVN_URL]
41
END
42
exit(1);
43
}
44
45
-getopts("b:C:dDhil:mM:o:s:t:T:uv") or usage();
45
+getopts("b:C:dDhil:mM:o:rs:t:T:uv") or usage();
46
usage if $opt_h;
47
48
my $tag_name = $opt_t || "tags";
@@ -650,6 +650,7 @@ sub commit {
650
$pr->reader();
651
652
$message =~ s/[\s\n]+\z//;
653
+ $message = "r$revision: $message" if $opt_r;
654
655
print $pw "$message\n"
656
or die "Error writing to git-commit-tree: $!\n";