diff options
author | Karl Hasselström <kha@treskal.com> | 2006-02-26 06:11:31 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-26 21:34:42 -0800 |
commit | 36610b24f1a1821eee95243663631c1295c202ed (patch) | |
tree | 50e5cb434d7a306c233c0733973597559ad31252 /git-svnimport.perl | |
parent | c55f3fff35ac34e6d1f0f686e27029612775e51d (diff) | |
download | git-36610b24f1a1821eee95243663631c1295c202ed.tar.gz |
svnimport: Read author names and emails from a 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.
Signed-off-by: Karl Hasselström <kha@treskal.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-svnimport.perl')
-rwxr-xr-x | git-svnimport.perl | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/git-svnimport.perl b/git-svnimport.perl index 0dd9fab9fe..75ce8e068a 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -30,7 +30,7 @@ $SIG{'PIPE'}="IGNORE"; $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; @@ -38,12 +38,12 @@ Usage: ${\basename $0} # fetch/update GIT from SVN [-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"; @@ -68,6 +68,19 @@ if ($opt_M) { 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); @@ -485,6 +498,10 @@ sub commit { 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 { |