summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-27 23:46:39 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-02-27 23:46:39 (GMT)
commitf3a4ec48e402a7b49d410bdcb23470e9723788b0 (patch)
tree6331b2bcc9dcee5c2370788e8db7c4562bb25263
parent7be737680fbb3dbce4f7ad1bc179a661532cd026 (diff)
parent80804d0af8f5bfa8ce87b5ef72cd2c5eb64c8f40 (diff)
downloadgit-f3a4ec48e402a7b49d410bdcb23470e9723788b0.zip
git-f3a4ec48e402a7b49d410bdcb23470e9723788b0.tar.gz
git-f3a4ec48e402a7b49d410bdcb23470e9723788b0.tar.bz2
Merge part of kh/svnimport branch into master
-rw-r--r--Documentation/git-svnimport.txt13
-rwxr-xr-xgit-svnimport.perl23
2 files changed, 32 insertions, 4 deletions
diff --git a/Documentation/git-svnimport.txt b/Documentation/git-svnimport.txt
index c95ff84..912a808 100644
--- a/Documentation/git-svnimport.txt
+++ b/Documentation/git-svnimport.txt
@@ -13,7 +13,8 @@ SYNOPSIS
[ -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
@@ -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 <author_file>::
+ Read a file with lines on the form
+
+ username = User's Full Name <email@addr.es>
+
+ and use "User's Full Name <email@addr.es>" 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..86837ed 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*<(.+)>\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 {