Skip to content

Commit

Permalink
Merge branch 'pb/cvsimport'
Browse files Browse the repository at this point in the history
* pb/cvsimport:
  cvsimport: document that -M can be used multiple times
  cvsimport: allow for multiple -M options
  cvsimport: have default merge regex allow for dashes in the branch name
  • Loading branch information
Junio C Hamano committed Mar 2, 2008
2 parents d2c425a + 3c832a7 commit ac6aa16
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
6 changes: 5 additions & 1 deletion Documentation/git-cvsimport.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 <regex>::
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 <regex>::
Skip paths matching the regex.
Expand Down
17 changes: 11 additions & 6 deletions git-cvsimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -29,7 +29,7 @@
$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(;$) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -164,10 +169,10 @@ sub read_repo_config {

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/);
if (@opt_M) {
push (@mergerx, map { qr/$_/ } @opt_M);
}

# Remember UTC of our starting time
Expand Down

0 comments on commit ac6aa16

Please sign in to comment.