summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c55f3ff)
raw | patch | inline | side by side (parent: c55f3ff)
author | Karl Hasselström <kha@treskal.com> | |
Sun, 26 Feb 2006 05:11:31 +0000 (06:11 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 27 Feb 2006 05:34:42 +0000 (21:34 -0800) |
Read a file with lines on the form
username User's Full Name <email@addres.org>
and use "User's Full Name <email@addres.org>" as the GIT author and
committer for Subversion commits made by "username". If encountering a
commit made by a user not in the list, abort.
Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
username User's Full Name <email@addres.org>
and use "User's Full Name <email@addres.org>" as the GIT author and
committer for Subversion commits made by "username". If encountering a
commit made by a user not in the list, abort.
Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Documentation/git-svnimport.txt | patch | blob | history | |
git-svnimport.perl | patch | blob | history |
index c95ff84f6aa7172c328a93be140a85a4e9ef7a09..e0e3a5d4e8aa9dce8be88e33606c878e8bb18403 100644 (file)
[ -C <GIT_repository> ] [ -i ] [ -u ] [-l limit_rev]
[ -b branch_subdir ] [ -T trunk_subdir ] [ -t tag_subdir ]
[ -s start_chg ] [ -m ] [ -r ] [ -M regex ]
- [ -I <ignorefile_name> ] <SVN_repository_URL> [ <path> ]
+ [ -I <ignorefile_name> ] [ -A <author_file> ]
+ <SVN_repository_URL> [ <path> ]
DESCRIPTION
syntaxes are similar enough that using the Subversion patterns
directly with "-I .gitignore" will almost always just work.)
+-A <author_file>::
+ Read a file with lines on the form
+
+ username User's Full Name <email@addres.org>
+
+ and use "User's Full Name <email@addres.org>" as the GIT
+ author and committer for Subversion commits made by
+ "username". If encountering a commit made by a user not in the
+ list, abort.
+
-m::
Attempt to detect merges based on the commit message. This option
will enable default regexes that try to capture the name source
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 0dd9fab9fea81243cc4c0e80ec93fe0489b368cd..75ce8e068a435928d48c78fbed98cd956d5153cf 100755 (executable)
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
$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_s,$opt_l,$opt_d,$opt_D);
+ $opt_b,$opt_r,$opt_I,$opt_A,$opt_s,$opt_l,$opt_d,$opt_D);
sub usage() {
print STDERR <<END;
[-o branch-for-HEAD] [-h] [-v] [-l max_rev]
[-C GIT_repository] [-t tagname] [-T trunkname] [-b branchname]
[-d|-D] [-i] [-u] [-r] [-I ignorefilename] [-s start_chg]
- [-m] [-M regex] [SVN_URL]
+ [-m] [-M regex] [-A author_file] [SVN_URL]
END
exit(1);
}
-getopts("b:C:dDhiI:l:mM:o:rs:t:T:uv") or usage();
+getopts("A:b:C:dDhiI:l:mM:o:rs:t:T:uv") or usage();
usage if $opt_h;
my $tag_name = $opt_t || "tags";
push (@mergerx, qr/$opt_M/);
}
+our %users = ();
+if ($opt_A) {
+ die "Cannot open $opt_A\n" unless -f $opt_A;
+ open(my $authors,$opt_A);
+ while(<$authors>) {
+ chomp;
+ next unless /^(\S+)\s+(.+?)\s+<(\S+)>$/;
+ (my $user,my $name,my $email) = ($1,$2,$3);
+ $users{$user} = [$name,$email];
+ }
+ close($authors);
+}
+
select(STDERR); $|=1; select(STDOUT);
if (not defined $author) {
$author_name = $author_email = "unknown";
+ } elsif ($opt_A) {
+ die "User $author is not listed in $opt_A\n"
+ unless exists $users{$author};
+ ($author_name,$author_email) = @{$users{$author}};
} elsif ($author =~ /^(.*?)\s+<(.*)>$/) {
($author_name, $author_email) = ($1, $2);
} else {