Skip to content

Commit 5179c8a

Browse files
Martin LanghoffJunio C Hamano
authored andcommitted
cvsimport: Add -S <skipfileregex> support and -v announces files retrieved
A couple of things that seem to help importing broken CVS repos... -S '<slash-delimited-regex>' skips files with a matching path -v prints file name and version before fetching from cvs Signed-off-by: Martin Langhoff <martin@catalyst.net.nz> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 36b5b3c commit 5179c8a

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

git-cvsimport.perl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@
2929
$SIG{'PIPE'}="IGNORE";
3030
$ENV{'TZ'}="UTC";
3131

32-
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);
32+
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);
3333
my (%conv_author_name, %conv_author_email);
3434

3535
sub usage() {
3636
print STDERR <<END;
3737
Usage: ${\basename $0} # fetch/update GIT from CVS
3838
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
3939
[-p opts-for-cvsps] [-C GIT_repository] [-z fuzz] [-i] [-k] [-u]
40-
[-s subst] [-m] [-M regex] [CVS_module]
40+
[-s subst] [-m] [-M regex] [-S regex] [CVS_module]
4141
END
4242
exit(1);
4343
}
@@ -85,7 +85,7 @@ ($)
8585
close ($f);
8686
}
8787

88-
getopts("hivmkuo:d:p:C:z:s:M:P:A:") or usage();
88+
getopts("hivmkuo:d:p:C:z:s:M:P:A:S:") or usage();
8989
usage if $opt_h;
9090

9191
@ARGV <= 1 or usage();
@@ -579,7 +579,7 @@ ($$)
579579
my $state = 0;
580580

581581
my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
582-
my(@old,@new);
582+
my(@old,@new,@skipped);
583583
my $commit = sub {
584584
my $pid;
585585
while(@old) {
@@ -675,6 +675,11 @@ ($$)
675675
substr($logmsg,32767) = "" if length($logmsg) > 32767;
676676
$logmsg =~ s/[\s\n]+\z//;
677677

678+
if (@skipped) {
679+
$logmsg .= "\n\n\nSKIPPED:\n\t";
680+
$logmsg .= join("\n\t", @skipped) . "\n";
681+
}
682+
678683
print $pw "$logmsg\n"
679684
or die "Error writing to git-commit-tree: $!\n";
680685
$pw->close();
@@ -832,6 +837,12 @@ ($$)
832837
my $fn = $1;
833838
my $rev = $3;
834839
$fn =~ s#^/+##;
840+
if ($opt_S && $fn =~ m/$opt_S/) {
841+
print "SKIPPING $fn v $rev\n";
842+
push(@skipped, $fn);
843+
next;
844+
}
845+
print "Fetching $fn v $rev\n" if $opt_v;
835846
my ($tmpname, $size) = $cvs->file($fn,$rev);
836847
if($size == -1) {
837848
push(@old,$fn);

0 commit comments

Comments
 (0)