summaryrefslogtreecommitdiff
path: root/git-svnimport.perl
diff options
context:
space:
mode:
authorFlorian Forster <octo@verplant.org>2006-05-31 12:32:08 +0200
committerJunio C Hamano <junkio@cox.net>2006-05-31 14:22:28 -0700
commit65160b8b04f814ab5b2573b32605320ff875f99e (patch)
treec0f12ea9981aa7dc902792d62a69793e273cb72d /git-svnimport.perl
parent1361fa3e49717de9588e6d925073eb6885cedaa3 (diff)
downloadgit-65160b8b04f814ab5b2573b32605320ff875f99e.tar.gz
git-svnimport: Improved detection of merges.
The regexes detecting merges (while still relying on the commit messages, though) have been improved to catch saner (and hopefully more) messages. The old regex was so generic that it often matched something else and missed the actual merge-message. Also, the regex given with the `-M' commandline-option is checked first: Explicitely given regexes should be considered better than the builtin ones, and should therefore be given a chance to match a message first. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-svnimport.perl')
-rwxr-xr-xgit-svnimport.perl11
1 files changed, 9 insertions, 2 deletions
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 61f559f0a8..38ac732ca9 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -63,10 +63,17 @@ my $svn_dir = $ARGV[1];
our @mergerx = ();
if ($opt_m) {
- @mergerx = ( qr/\W(?:from|of|merge|merging|merged) (\w+)/i );
+ my $branch_esc = quotemeta ($branch_name);
+ my $trunk_esc = quotemeta ($trunk_name);
+ @mergerx =
+ (
+ qr!\b(?:merg(?:ed?|ing))\b.*?\b((?:(?<=$branch_esc/)[\w\.\-]+)|(?:$trunk_esc))\b!i,
+ qr!\b(?:from|of)\W+((?:(?<=$branch_esc/)[\w\.\-]+)|(?:$trunk_esc))\b!i,
+ qr!\b(?:from|of)\W+(?:the )?([\w\.\-]+)[-\s]branch\b!i
+ );
}
if ($opt_M) {
- push (@mergerx, qr/$opt_M/);
+ unshift (@mergerx, qr/$opt_M/);
}
# Absolutize filename now, since we will have chdir'ed by the time we