summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de451df)
raw | patch | inline | side by side (parent: de451df)
author | Avery Pennarun <apenwarr@versabanq.com> | |
Wed, 16 Apr 2008 01:04:17 +0000 (21:04 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 May 2008 00:42:29 +0000 (17:42 -0700) |
This option adds a From: line (based on the commit's author information)
at the beginning of the body of the commit log message when sending to
svn, if a From: or Signed-off-by: header does not exist.
This, combined with --use-log-author, can retain the author field of commits
through a round trip from git to svn and back.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
at the beginning of the body of the commit log message when sending to
svn, if a From: or Signed-off-by: header does not exist.
This, combined with --use-log-author, can retain the author field of commits
through a round trip from git to svn and back.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-svn.perl | patch | blob | history |
diff --git a/git-svn.perl b/git-svn.perl
index b70f8efaaa404d63c6a45486f8513348cbb368f5..262acd9b365aba6ce5a0e1623e95cefd9c867a45 100755 (executable)
--- a/git-svn.perl
+++ b/git-svn.perl
'repack-flags|repack-args|repack-opts=s' =>
\$Git::SVN::_repack_flags,
'use-log-author' => \$Git::SVN::_use_log_author,
+ 'add-author-from' => \$Git::SVN::_add_author_from,
%remote_opts );
my ($_trunk, $_tags, $_branches, $_stdlayout);
my ($msg_fh, $ctx) = command_output_pipe('cat-file',
$type, $treeish);
my $in_msg = 0;
+ my $author;
+ my $saw_from = 0;
while (<$msg_fh>) {
if (!$in_msg) {
$in_msg = 1 if (/^\s*$/);
+ $author = $1 if (/^author (.*>)/);
} elsif (/^git-svn-id: /) {
# skip this for now, we regenerate the
# correct one on re-fetch anyways
# TODO: set *:merge properties or like...
} else {
+ if (/^From:/ || /^Signed-off-by:/) {
+ $saw_from = 1;
+ }
print $log_fh $_ or croak $!;
}
}
+ if ($Git::SVN::_add_author_from && defined($author)
+ && !$saw_from) {
+ print $log_fh "\nFrom: $author\n"
+ or croak $!;
+ }
command_close_pipe($msg_fh, $ctx);
}
close $log_fh or croak $!;
use vars qw/$default_repo_id $default_ref_id $_no_metadata $_follow_parent
$_repack $_repack_flags $_use_svm_props $_head
$_use_svnsync_props $no_reuse_existing $_minimize_url
- $_use_log_author/;
+ $_use_log_author $_add_author_from/;
use Carp qw/croak/;
use File::Path qw/mkpath/;
use File::Copy qw/copy/;