From fbbbc362ab9d3a8d76eb4273e65fb1fb26849d75 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK" Date: Thu, 28 Feb 2008 11:18:21 +0100 Subject: cvsimport: have default merge regex allow for dashes in the branch name The default value of @mergerx uses \w, which matches word character; a branch name like policy-20050608-br will not be matched. Signed-off-by: Philippe Bruhat (BooK) Signed-off-by: Junio C Hamano diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 9516242..3d013a7 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -164,7 +164,7 @@ if ($#ARGV == 0) { our @mergerx = (); if ($opt_m) { - @mergerx = ( qr/\b(?:from|of|merge|merging|merged) (\w+)/i ); + @mergerx = ( qr/\b(?:from|of|merge|merging|merged) ([-\w]+)/i ); } if ($opt_M) { push (@mergerx, qr/$opt_M/); -- cgit v0.10.2-6-g49f6 From bc434e829c6f1757d2761c50e06a28278dc2f2c7 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK" Date: Thu, 28 Feb 2008 11:18:22 +0100 Subject: cvsimport: allow for multiple -M options Use Getopt::Long instead of Getopt::Std to handle multiple -M options, for all the cases when having a single custom regex is not enough. Signed-off-by: Philippe Bruhat (BooK) Signed-off-by: Junio C Hamano diff --git a/git-cvsimport.perl b/git-cvsimport.perl index 3d013a7..47f116f 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -15,7 +15,7 @@ use strict; use warnings; -use Getopt::Std; +use Getopt::Long; use File::Spec; use File::Temp qw(tempfile tmpnam); use File::Path qw(mkpath); @@ -29,7 +29,7 @@ use IPC::Open2; $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; -our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,$opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r); +our ($opt_h,$opt_o,$opt_v,$opt_k,$opt_u,$opt_d,$opt_p,$opt_C,$opt_z,$opt_i,$opt_P, $opt_s,$opt_m,@opt_M,$opt_A,$opt_S,$opt_L, $opt_a, $opt_r); my (%conv_author_name, %conv_author_email); sub usage(;$) { @@ -112,7 +112,12 @@ sub read_repo_config { my $opts = "haivmkuo:d:p:r:C:z:s:M:P:A:S:L:"; read_repo_config($opts); -getopts($opts) or usage(); +Getopt::Long::Configure( 'no_ignore_case', 'bundling' ); + +# turn the Getopt::Std specification in a Getopt::Long one, +# with support for multiple -M options +GetOptions( map { s/:/=s/; /M/ ? "$_\@" : $_ } split( /(?!:)/, $opts ) ) + or usage(); usage if $opt_h; if (@ARGV == 0) { @@ -166,8 +171,8 @@ our @mergerx = (); if ($opt_m) { @mergerx = ( qr/\b(?:from|of|merge|merging|merged) ([-\w]+)/i ); } -if ($opt_M) { - push (@mergerx, qr/$opt_M/); +if (@opt_M) { + push (@mergerx, map { qr/$_/ } @opt_M); } # Remember UTC of our starting time -- cgit v0.10.2-6-g49f6 From 3c832a78b15f8ffcb4e6f1f6f6d8b7a607ba5d06 Mon Sep 17 00:00:00 2001 From: "Philippe Bruhat (BooK" Date: Thu, 28 Feb 2008 11:18:23 +0100 Subject: cvsimport: document that -M can be used multiple times Also document the capture behaviour (source branch name in $1) Signed-off-by: Philippe Bruhat (BooK) Signed-off-by: Junio C Hamano diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt index 6f91b9e..58eefd4 100644 --- a/Documentation/git-cvsimport.txt +++ b/Documentation/git-cvsimport.txt @@ -102,13 +102,17 @@ If you need to pass multiple options, separate them with a comma. -m:: Attempt to detect merges based on the commit message. This option - will enable default regexes that try to capture the name source + will enable default regexes that try to capture the source branch name from the commit message. -M :: Attempt to detect merges based on the commit message with a custom regex. It can be used with '-m' to enable the default regexes as well. You must escape forward slashes. ++ +The regex must capture the source branch name in $1. ++ +This option can be used several times to provide several detection regexes. -S :: Skip paths matching the regex. -- cgit v0.10.2-6-g49f6