{"thread":{"id":"12239","subject":"[PATCH] cvsimport: allow for multiple -M options","startedAt":"2008-02-21T14:25:49Z","lastAt":"2008-02-23T22:51:49Z","messageCount":2,"participants":["Philippe Bruhat (BooK)","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"69474","messageId":"1203603949-27790-1-git-send-email-book@cpan.org","threadId":"12239","inReplyTo":null,"subject":"[PATCH] cvsimport: allow for multiple -M options","fromName":"Philippe Bruhat (BooK)","fromEmail":"book@cpan.org","sentAt":"2008-02-21T14:25:49Z","receivedAt":"2008-02-21T14:25:49Z","isPatch":true,"sender":{"key":"book@cpan.org","avatar":"https://avatars.githubusercontent.com/u/44421?v=4"},"body":"Use Getopt::Long instead of Getopt::Std to handle multiple -M options,\nfor all the cases when having a single custom regex is not enough.\n\nFor example, \"merged (\\w+)\" and \"(\\w+) merged\" can't be easily turned\ninto a single regular expression capturing the branch name in $1.\n\nSigned-off-by: Philippe Bruhat (BooK) <book@cpan.org>\n---\n git-cvsimport.perl |   15 ++++++++++-----\n 1 files changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/git-cvsimport.perl b/git-cvsimport.perl\nindex 3d013a7..f138a01 100755\n--- a/git-cvsimport.perl\n+++ b/git-cvsimport.perl\n@@ -15,7 +15,7 @@\n \n use strict;\n use warnings;\n-use Getopt::Std;\n+use Getopt::Long;\n use File::Spec;\n use File::Temp qw(tempfile tmpnam);\n use File::Path qw(mkpath);\n@@ -29,7 +29,7 @@ use IPC::Open2;\n $SIG{'PIPE'}=\"IGNORE\";\n $ENV{'TZ'}=\"UTC\";\n \n-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);\n+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);\n my (%conv_author_name, %conv_author_email);\n \n sub usage(;$) {\n@@ -112,7 +112,12 @@ sub read_repo_config {\n \n my $opts = \"haivmkuo:d:p:r:C:z:s:M:P:A:S:L:\";\n read_repo_config($opts);\n-getopts($opts) or usage();\n+Getopt::Long::Configure( 'no_ignore_case' );\n+\n+# turn the Getopt::Std specification in a Getopt::Long one,\n+# with support for multiple -M options\n+GetOptions( map { s/:/=s/; /M/ ? \"$_\\@\" : $_ } split( /(?!:)/, $opts ) )\n+    or usage();\n usage if $opt_h;\n \n if (@ARGV == 0) {\n@@ -166,8 +171,8 @@ our @mergerx = ();\n if ($opt_m) {\n \t@mergerx = ( qr/\\b(?:from|of|merge|merging|merged) ([-\\w]+)/i );\n }\n-if ($opt_M) {\n-\tpush (@mergerx, qr/$opt_M/);\n+if (@opt_M) {\n+\tpush (@mergerx, map { qr/$_/ } @opt_M);\n }\n \n # Remember UTC of our starting time\n-- \n1.5.4.1\n"},{"id":"69731","messageId":"7vmyprz3p6.fsf@gitster.siamese.dyndns.org","threadId":"12239","inReplyTo":"1203603949-27790-1-git-send-email-book@cpan.org","subject":"Re: [PATCH] cvsimport: allow for multiple -M options","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-23T22:51:49Z","receivedAt":"2008-02-23T22:51:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This seems to break t9600.\n\n* expecting success:\n\n        cd module-git &&\n                git config cvsimport.module module &&\n                git cvsimport -a -z0 &&\n                git merge origin &&\n        cd .. &&\n        git diff module-cvs/tick module-git/tick\n\n\nUnknown option: z0\nUsage: git-cvsimport     # fetch/update GIT from CVS\n       [-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A\n       author-conv-file]\n       [-p opts-for-cvsps] [-P file] [-C GIT_repository] [-z\n       fuzz] [-i] [-k]\n       [-u] [-s subst] [-a] [-m] [-M regex] [-S regex] [-L\n       commitlimit]\n       [-r remote] [CVS_module]\n* FAIL 8: cvsimport.module config works\n"}]}