svnimport: add support for parsing From: lines for author
When commiting a non-signed off contribution you cannot just add a Signed-off-by: from the author as they did not sign it off. But if you then commit it, and necessarily sign it off yourself, the change appears to be yours. In this case it is common to use the following form: Commentry From: originator <email> Signed-of-by: me <my email> Now that we have support for parsing Signed-off-by: for author information it makes sense to handle From: as well. This patch adds a new -F which will handle From: lines in the comments. It may be used in combination with -S. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Andy Whitcroft committed
Sep 25, 2006 at 12:08 UTC
7b40e7d1ab20aebaac86b4586d48b6b645da57d1
1 file changed
+8
-4
git-svnimport.perl
+8
-4
@@ -31,7 +31,7 @@ $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,
34
- $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S);
34
+ $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D,$opt_S,$opt_F);
35
36
sub usage() {
37
print STDERR <<END;
@@ -39,12 +39,12 @@ Usage: ${\basename $0} # fetch/update GIT from SVN
39
[-o branch-for-HEAD] [-h] [-v] [-l max_rev]
40
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
41
[-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]
42
- [-m] [-M regex] [-A author_file] [-S] [SVN_URL]
42
+ [-m] [-M regex] [-A author_file] [-S] [-F] [SVN_URL]
43
END
44
exit(1);
45
}
46
47
-getopts("A:b:C:dDhiI:l:mM:o:rs:t:T:Suv") or usage();
47
+getopts("A:b:C:dDFhiI:l:mM:o:rs:t:T:Suv") or usage();
48
usage if $opt_h;
49
50
my $tag_name = $opt_t || "tags";
@@ -548,8 +548,12 @@ sub commit {
548
$committer_name = $committer_email = $author;
549
}
550
551
- if ($opt_S && $message =~ /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
551
+ if ($opt_F && $message =~ /From:\s+(.*?)\s+<(.*)>\s*\n/) {
552
($author_name, $author_email) = ($1, $2);
553
+ print "Author from From: $1 <$2>\n" if ($opt_v);;
554
+ } elsif ($opt_S && $message =~ /Signed-off-by:\s+(.*?)\s+<(.*)>\s*\n/) {
555
+ ($author_name, $author_email) = ($1, $2);
556
+ print "Author from Signed-off-by: $1 <$2>\n" if ($opt_v);;
557
} else {
558
$author_name = $committer_name;
559
$author_email = $committer_email;