From: Ramkumar Ramachandra <artagnon@gmail.com>
To: "Love Hörnquist Åstrand" <lha@kth.se>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
Joe Corneli <holtzermann17@gmail.com>,
Git List <git@vger.kernel.org>,
Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH] Optionally parse author information
Date: Fri, 14 Jan 2011 15:46:38 +0530 [thread overview]
Message-ID: <20110114101636.GA22970@kytes> (raw)
In-Reply-To: <F0299861-B36C-459C-972E-856212A92615@kth.se>
When creating a new commit, instead of picking up the SVN author from
the committer's email, pick it up from the author's email, when
possible. Also add a new command-line switch '--ignore-author' to
force older behavior for backward compatibilty.
Noticed-by: Joe Corneli <holtzermann17@gmail.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
git2svn | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/git2svn b/git2svn
index 2380775..8ef55f1 100755
--- a/git2svn
+++ b/git2svn
@@ -36,7 +36,7 @@ use Pod::Usage;
my $IN;
my $OUT;
-my ($help, $verbose, $keeplogs, $no_load);
+my ($help, $verbose, $keeplogs, $no_load, $ignore_author);
# svn
my $svntree = "repro";
@@ -200,6 +200,7 @@ $result = GetOptions ("git-branch=s" => \$branch,
"svn-prefix=s" => \$basedir,
"keep-logs" => \$keeplogs,
"no-load" => \$no_load,
+ "ignore-author" => \$ignore_author,
"verbose+" => \$verbose,
"help" => \$help) or pod2usage(2);
@@ -261,12 +262,15 @@ COMMAND: while (!eof(IN)) {
$commit{Mark} = $1;
$next = next_line($IN);
}
- if ($next =~ m/author +(.*)/) {
- $commit{Author} = $1;
+ if ($next =~ m/author +(.+) +<([^>]+)> +(\d+) +[+-](\d+)$/) {
+ $commit{AuthorName} = $1;
+ $commit{AuthorEmail} = $2;
+ $commit{AuthorWhen} = $3;
+ $commit{AuthorTZ} = $4;
$next = next_line($IN);
}
unless ($next =~ m/committer +(.+) +<([^>]+)> +(\d+) +[+-](\d+)$/) {
- die "missing comitter: $_";
+ die "missing committer: $_";
}
$commit{CommitterName} = $1;
@@ -291,11 +295,15 @@ COMMAND: while (!eof(IN)) {
strftime("%Y-%m-%dT%H:%M:%S.000000Z",
gmtime($commit{CommitterWhen}));
- my $author = "(no author)";
+ my $author = "git2svn-dump";
if ($commit{CommitterEmail} =~ m/([^@]+)/) {
$author = $1;
}
- $author = "git2svn-dump" if ($author eq "(no author)");
+ unless ($ignore_author) {
+ if ($commit{AuthorEmail} =~ m/([^@]+)/) {
+ $author = $1;
+ }
+ }
my $props = "";
$props .= prop("svn:author", $author);
@@ -486,6 +494,11 @@ match the default GIT branch (master).
Don't load the svn repository or update the syncpoint tagname.
+=item B<--ignore-author>
+
+Ignore "author" lines in the fast-import stream. Use "committer"
+information instead.
+
=item B<--keep-logs>
Don't delete the logs in $CWD/.data on success.
--
1.7.4.rc1.7.g2cf08.dirty
next prev parent reply other threads:[~2011-01-14 10:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 1:27 working with a large repository and git svn Joe Corneli
2011-01-12 15:30 ` Wesley J. Landaker
2011-01-13 0:54 ` Joe Corneli
2011-01-13 3:23 ` Jonathan Nieder
2011-01-14 7:43 ` Joe Corneli
2011-01-14 8:05 ` Ramkumar Ramachandra
2011-01-14 8:29 ` Jonathan Nieder
2011-01-14 9:23 ` Michael Haggerty
[not found] ` <F0299861-B36C-459C-972E-856212A92615@kth.se>
2011-01-14 10:16 ` Ramkumar Ramachandra [this message]
2011-01-16 2:17 ` [PATCH] Optionally parse author information Joe Corneli
2011-01-16 2:57 ` Jonathan Nieder
2011-01-16 3:32 ` Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110114101636.GA22970@kytes \
--to=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=holtzermann17@gmail.com \
--cc=jrnieder@gmail.com \
--cc=lha@kth.se \
--cc=mhagger@alum.mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.