summaryrefslogtreecommitdiff
path: root/git-cvsimport.perl
diff options
context:
space:
mode:
authorPhilippe Bruhat (BooK <book@cpan.org>2008-02-28 11:18:22 +0100
committerJunio C Hamano <gitster@pobox.com>2008-03-01 00:55:38 -0800
commitbc434e829c6f1757d2761c50e06a28278dc2f2c7 (patch)
treecd3b572149d78005ebbe843ba03bd8783d8379a6 /git-cvsimport.perl
parentfbbbc362ab9d3a8d76eb4273e65fb1fb26849d75 (diff)
downloadgit-bc434e829c6f1757d2761c50e06a28278dc2f2c7.tar.gz
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) <book@cpan.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-cvsimport.perl')
-rwxr-xr-xgit-cvsimport.perl15
1 files changed, 10 insertions, 5 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 3d013a7d62..47f116f37e 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