[PATCH] cvsgit fixes: spaces in filenames and CVS server dialog woes
Problems found while importing dasher's CVS: * Allow spaces in filenames. * cvsps may create unnamed branches with revisions that don't really exist, which causes the CVS server to return something we haven't hitherto expected. * Report deleted files when being verbose. * Also, report the commit date. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
8c59890292
commit
8b8840e046
@ -294,6 +294,12 @@ sub _line {
|
|||||||
return $res;
|
return $res;
|
||||||
} elsif($line =~ s/^E //) {
|
} elsif($line =~ s/^E //) {
|
||||||
# print STDERR "S: $line\n";
|
# print STDERR "S: $line\n";
|
||||||
|
} elsif($line =~ /^Remove-entry /i) {
|
||||||
|
$line = $self->readline(); # filename
|
||||||
|
$line = $self->readline(); # OK
|
||||||
|
chomp $line;
|
||||||
|
die "Unknown: $line" if $line ne "ok";
|
||||||
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
die "Unknown: $line\n";
|
die "Unknown: $line\n";
|
||||||
}
|
}
|
||||||
@ -561,7 +567,7 @@ my $commit = sub {
|
|||||||
or die "Error writing to git-commit-tree: $!\n";
|
or die "Error writing to git-commit-tree: $!\n";
|
||||||
$pw->close();
|
$pw->close();
|
||||||
|
|
||||||
print "Committed patch $patchset ($branch)\n" if $opt_v;
|
print "Committed patch $patchset ($branch ".strftime("%Y-%m-%d %H:%M:%S",gmtime($date)).")\n" if $opt_v;
|
||||||
chomp(my $cid = <$pr>);
|
chomp(my $cid = <$pr>);
|
||||||
length($cid) == 40
|
length($cid) == 40
|
||||||
or die "Cannot get commit id ($cid): $!\n";
|
or die "Cannot get commit id ($cid): $!\n";
|
||||||
@ -675,26 +681,32 @@ while(<CVS>) {
|
|||||||
$state = 9;
|
$state = 9;
|
||||||
} elsif($state == 8) {
|
} elsif($state == 8) {
|
||||||
$logmsg .= "$_\n";
|
$logmsg .= "$_\n";
|
||||||
} elsif($state == 9 and /^\s+(\S+):(INITIAL|\d+(?:\.\d+)+)->(\d+(?:\.\d+)+)\s*$/) {
|
} elsif($state == 9 and /^\s+(.+?):(INITIAL|\d+(?:\.\d+)+)->(\d+(?:\.\d+)+)\s*$/) {
|
||||||
# VERSION:1.96->1.96.2.1
|
# VERSION:1.96->1.96.2.1
|
||||||
my $init = ($2 eq "INITIAL");
|
my $init = ($2 eq "INITIAL");
|
||||||
my $fn = $1;
|
my $fn = $1;
|
||||||
my $rev = $3;
|
my $rev = $3;
|
||||||
$fn =~ s#^/+##;
|
$fn =~ s#^/+##;
|
||||||
my ($tmpname, $size) = $cvs->file($fn,$rev);
|
my ($tmpname, $size) = $cvs->file($fn,$rev);
|
||||||
print "".($init ? "New" : "Update")." $fn: $size bytes.\n" if $opt_v;
|
if($size == -1) {
|
||||||
open my $F, '-|', "git-hash-object -w $tmpname"
|
push(@old,$fn);
|
||||||
or die "Cannot create object: $!\n";
|
print "Drop $fn\n" if $opt_v;
|
||||||
my $sha = <$F>;
|
} else {
|
||||||
chomp $sha;
|
print "".($init ? "New" : "Update")." $fn: $size bytes\n" if $opt_v;
|
||||||
close $F;
|
open my $F, '-|', "git-hash-object -w $tmpname"
|
||||||
|
or die "Cannot create object: $!\n";
|
||||||
|
my $sha = <$F>;
|
||||||
|
chomp $sha;
|
||||||
|
close $F;
|
||||||
|
my $mode = pmode($cvs->{'mode'});
|
||||||
|
push(@new,[$mode, $sha, $fn]); # may be resurrected!
|
||||||
|
}
|
||||||
unlink($tmpname);
|
unlink($tmpname);
|
||||||
my $mode = pmode($cvs->{'mode'});
|
} elsif($state == 9 and /^\s+(.+?):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) {
|
||||||
push(@new,[$mode, $sha, $fn]); # may be resurrected!
|
|
||||||
} elsif($state == 9 and /^\s+(\S+):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) {
|
|
||||||
my $fn = $1;
|
my $fn = $1;
|
||||||
$fn =~ s#^/+##;
|
$fn =~ s#^/+##;
|
||||||
push(@old,$fn);
|
push(@old,$fn);
|
||||||
|
print "Delete $fn\n" if $opt_v;
|
||||||
} elsif($state == 9 and /^\s*$/) {
|
} elsif($state == 9 and /^\s*$/) {
|
||||||
$state = 10;
|
$state = 10;
|
||||||
} elsif(($state == 9 or $state == 10) and /^-+$/) {
|
} elsif(($state == 9 or $state == 10) and /^-+$/) {
|
||||||
|
Loading…
Reference in New Issue
Block a user