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>
Martin Langhoff committed
Jan 30, 2006 at 19:12 UTC
5179c8a54f76dcbdbfc96eed3a4e64a30d8d562d
1 file changed
+15
-4
git-cvsimport.perl
+15
-4
@@ -29,7 +29,7 @@ use IPC::Open2;
29
$SIG{'PIPE'}="IGNORE";
30
$ENV{'TZ'}="UTC";
31
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);
33
my (%conv_author_name, %conv_author_email);
34
35
sub usage() {
@@ -37,7 +37,7 @@ sub usage() {
37
Usage: ${\basename $0} # fetch/update GIT from CVS
38
[-o branch-for-HEAD] [-h] [-v] [-d CVSROOT] [-A author-conv-file]
39
[-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]
41
END
42
exit(1);
43
}
@@ -85,7 +85,7 @@ sub write_author_info($) {
85
close ($f);
86
}
87
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();
89
usage if $opt_h;
90
91
@ARGV <= 1 or usage();
@@ -579,7 +579,7 @@ unless($pid) {
579
my $state = 0;
580
581
my($patchset,$date,$author_name,$author_email,$branch,$ancestor,$tag,$logmsg);
582
-my(@old,@new);
582
+my(@old,@new,@skipped);
583
my $commit = sub {
584
my $pid;
585
while(@old) {
@@ -675,6 +675,11 @@ my $commit = sub {
675
substr($logmsg,32767) = "" if length($logmsg) > 32767;
676
$logmsg =~ s/[\s\n]+\z//;
677
678
+ if (@skipped) {
679
+ $logmsg .= "\n\n\nSKIPPED:\n\t";
680
+ $logmsg .= join("\n\t", @skipped) . "\n";
681
+ }
682
+
683
print $pw "$logmsg\n"
684
or die "Error writing to git-commit-tree: $!\n";
685
$pw->close();
@@ -832,6 +837,12 @@ while(<CVS>) {
837
my $fn = $1;
838
my $rev = $3;
839
$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;
846
my ($tmpname, $size) = $cvs->file($fn,$rev);
847
if($size == -1) {
848
push(@old,$fn);