From 36610b24f1a1821eee95243663631c1295c202ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20=20Hasselstr=C3=B6m?= Date: Sun, 26 Feb 2006 06:11:31 +0100 Subject: svnimport: Read author names and emails from a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Read a file with lines on the form username User's Full Name and use "User's Full Name " 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 Signed-off-by: Junio C Hamano diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt index c95ff84..e0e3a5d 100644 --- a/Documentation/git-svnimport.txt +++ b/Documentation/git-svnimport.txt @@ -13,7 +13,8 @@ SYNOPSIS [ -C ] [ -i ] [ -u ] [-l limit_rev] [ -b branch_subdir ] [ -T trunk_subdir ] [ -t tag_subdir ] [ -s start_chg ] [ -m ] [ -r ] [ -M regex ] - [ -I ] [ ] + [ -I ] [ -A ] + [ ] DESCRIPTION @@ -71,6 +72,16 @@ When importing incrementally, you might need to edit the .git/svn2git file. syntaxes are similar enough that using the Subversion patterns directly with "-I .gitignore" will almost always just work.) +-A :: + Read a file with lines on the form + + username User's Full Name + + and use "User's Full Name " 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 0dd9fab..75ce8e0 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 <) { + 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 { -- cgit v0.10.2-6-g49f6 From 80804d0af8f5bfa8ce87b5ef72cd2c5eb64c8f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20=20Hasselstr=C3=B6m?= Date: Tue, 28 Feb 2006 00:08:15 +0100 Subject: Let git-svnimport's author file use same syntax as git-cvsimport's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-cvsimport uses a username => Full Name mapping file with this syntax: kha=Karl Hasselström Since there is no reason to use another format for git-svnimport, use the same format. Signed-off-by: Karl Hasselström Signed-off-by: Junio C Hamano diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt index e0e3a5d..912a808 100644 --- a/Documentation/git-svnimport.txt +++ b/Documentation/git-svnimport.txt @@ -75,9 +75,9 @@ When importing incrementally, you might need to edit the .git/svn2git file. -A :: Read a file with lines on the form - username User's Full Name + username = User's Full Name - and use "User's Full Name " as the GIT + and use "User's Full Name " 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. diff --git a/git-svnimport.perl b/git-svnimport.perl index 75ce8e0..86837ed 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -74,7 +74,7 @@ if ($opt_A) { open(my $authors,$opt_A); while(<$authors>) { chomp; - next unless /^(\S+)\s+(.+?)\s+<(\S+)>$/; + next unless /^(\S+?)\s*=\s*(.+?)\s*<(.+)>\s*$/; (my $user,my $name,my $email) = ($1,$2,$3); $users{$user} = [$name,$email]; } -- cgit v0.10.2-6-g49f6