{"thread":{"id":"1517","subject":"[PATCH] cvsgit fixes: spaces in filenames and CVS server dialog woes","startedAt":"2005-08-15T09:28:34Z","lastAt":"2005-08-15T09:28:34Z","messageCount":1,"participants":["Matthias Urlichs"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"7290","messageId":"pan.2005.08.15.09.28.12.779733@smurf.noris.de","threadId":"1517","inReplyTo":null,"subject":"[PATCH] cvsgit fixes: spaces in filenames and CVS server dialog woes","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-08-15T09:28:34Z","receivedAt":"2005-08-15T09:28:34Z","isPatch":true,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Problems found while importing dasher's CVS:\n\n* Allow spaces in filenames.\n* cvsps may create unnamed branches with revisions that don't really\n  exist, which causes the CVS server to return something we haven't\n  hitherto expected.\n* Report deleted files when being verbose.\n* Also, report the commit date.\n\ndiff --git a/git-cvsimport-script b/git-cvsimport-script\n--- a/git-cvsimport-script\n+++ b/git-cvsimport-script\n@@ -294,6 +293,12 @@ sub _line {\n \t\t\t\treturn $res;\n \t\t\t} elsif($line =~ s/^E //) {\n \t\t\t\t# print STDERR \"S: $line\\n\";\n+\t\t\t} elsif($line =~ /^Remove-entry /i) {\n+\t\t\t\t$line = $self->readline(); # filename\n+\t\t\t\t$line = $self->readline(); # OK\n+\t\t\t\tchomp $line;\n+\t\t\t\tdie \"Unknown: $line\" if $line ne \"ok\";\n+\t\t\t\treturn -1;\n \t\t\t} else {\n \t\t\t\tdie \"Unknown: $line\\n\";\n \t\t\t}\n@@ -561,7 +566,7 @@ my $commit = sub {\n \t\tor die \"Error writing to git-commit-tree: $!\\n\";\n \t$pw->close();\n \n-\tprint \"Committed patch $patchset ($branch)\\n\" if $opt_v;\n+\tprint \"Committed patch $patchset ($branch \".strftime(\"%Y-%m-%d %H:%M:%S\",gmtime($date)).\")\\n\" if $opt_v;\n \tchomp(my $cid = <$pr>);\n \tlength($cid) == 40\n \t\tor die \"Cannot get commit id ($cid): $!\\n\";\n@@ -675,26 +680,32 @@ while(<CVS>) {\n \t\t$state = 9;\n \t} elsif($state == 8) {\n \t\t$logmsg .= \"$_\\n\";\n-\t} elsif($state == 9 and /^\\s+(\\S+):(INITIAL|\\d+(?:\\.\\d+)+)->(\\d+(?:\\.\\d+)+)\\s*$/) {\n+\t} elsif($state == 9 and /^\\s+(.+?):(INITIAL|\\d+(?:\\.\\d+)+)->(\\d+(?:\\.\\d+)+)\\s*$/) {\n #\tVERSION:1.96->1.96.2.1\n \t\tmy $init = ($2 eq \"INITIAL\");\n \t\tmy $fn = $1;\n \t\tmy $rev = $3;\n \t\t$fn =~ s#^/+##;\n \t\tmy ($tmpname, $size) = $cvs->file($fn,$rev);\n-\t\tprint \"\".($init ? \"New\" : \"Update\").\" $fn: $size bytes.\\n\" if $opt_v;\n-\t\topen my $F, '-|', \"git-hash-object -w $tmpname\"\n-\t\t\tor die \"Cannot create object: $!\\n\";\n-\t\tmy $sha = <$F>;\n-\t\tchomp $sha;\n-\t\tclose $F;\n+\t\tif($size == -1) {\n+\t\t\tpush(@old,$fn);\n+\t\t\tprint \"Drop $fn\\n\" if $opt_v;\n+\t\t} else {\n+\t\t\tprint \"\".($init ? \"New\" : \"Update\").\" $fn: $size bytes\\n\" if $opt_v;\n+\t\t\topen my $F, '-|', \"git-hash-object -w $tmpname\"\n+\t\t\t\tor die \"Cannot create object: $!\\n\";\n+\t\t\tmy $sha = <$F>;\n+\t\t\tchomp $sha;\n+\t\t\tclose $F;\n+\t\t\tmy $mode = pmode($cvs->{'mode'});\n+\t\t\tpush(@new,[$mode, $sha, $fn]); # may be resurrected!\n+\t\t}\n \t\tunlink($tmpname);\n-\t\tmy $mode = pmode($cvs->{'mode'});\n-\t\tpush(@new,[$mode, $sha, $fn]); # may be resurrected!\n-\t} elsif($state == 9 and /^\\s+(\\S+):\\d(?:\\.\\d+)+->(\\d(?:\\.\\d+)+)\\(DEAD\\)\\s*$/) {\n+\t} elsif($state == 9 and /^\\s+(.+?):\\d(?:\\.\\d+)+->(\\d(?:\\.\\d+)+)\\(DEAD\\)\\s*$/) {\n \t\tmy $fn = $1;\n \t\t$fn =~ s#^/+##;\n \t\tpush(@old,$fn);\n+\t\tprint \"Delete $fn\\n\" if $opt_v;\n \t} elsif($state == 9 and /^\\s*$/) {\n \t\t$state = 10;\n \t} elsif(($state == 9 or $state == 10) and /^-+$/) {\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nLet he who takes the plunge remember to return it by Tuesday.\n"}]}