Git development
 help / color / mirror / Atom feed
From: Matthias Urlichs <smurf@smurf.noris.de>
To: git@vger.kernel.org
Subject: [PATCH] cvsgit fixes: spaces in filenames and CVS server dialog woes
Date: Mon, 15 Aug 2005 11:28:34 +0200	[thread overview]
Message-ID: <pan.2005.08.15.09.28.12.779733@smurf.noris.de> (raw)

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.

diff --git a/git-cvsimport-script b/git-cvsimport-script
--- a/git-cvsimport-script
+++ b/git-cvsimport-script
@@ -294,6 +293,12 @@ sub _line {
 				return $res;
 			} elsif($line =~ s/^E //) {
 				# 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 {
 				die "Unknown: $line\n";
 			}
@@ -561,7 +566,7 @@ my $commit = sub {
 		or die "Error writing to git-commit-tree: $!\n";
 	$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>);
 	length($cid) == 40
 		or die "Cannot get commit id ($cid): $!\n";
@@ -675,26 +680,32 @@ while(<CVS>) {
 		$state = 9;
 	} elsif($state == 8) {
 		$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
 		my $init = ($2 eq "INITIAL");
 		my $fn = $1;
 		my $rev = $3;
 		$fn =~ s#^/+##;
 		my ($tmpname, $size) = $cvs->file($fn,$rev);
-		print "".($init ? "New" : "Update")." $fn: $size bytes.\n" if $opt_v;
-		open my $F, '-|', "git-hash-object -w $tmpname"
-			or die "Cannot create object: $!\n";
-		my $sha = <$F>;
-		chomp $sha;
-		close $F;
+		if($size == -1) {
+			push(@old,$fn);
+			print "Drop $fn\n" if $opt_v;
+		} else {
+			print "".($init ? "New" : "Update")." $fn: $size bytes\n" if $opt_v;
+			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);
-		my $mode = pmode($cvs->{'mode'});
-		push(@new,[$mode, $sha, $fn]); # may be resurrected!
-	} elsif($state == 9 and /^\s+(\S+):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) {
+	} elsif($state == 9 and /^\s+(.+?):\d(?:\.\d+)+->(\d(?:\.\d+)+)\(DEAD\)\s*$/) {
 		my $fn = $1;
 		$fn =~ s#^/+##;
 		push(@old,$fn);
+		print "Delete $fn\n" if $opt_v;
 	} elsif($state == 9 and /^\s*$/) {
 		$state = 10;
 	} elsif(($state == 9 or $state == 10) and /^-+$/) {
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de
Disclaimer: The quote was selected randomly. Really. | http://smurf.noris.de
 - -
Let he who takes the plunge remember to return it by Tuesday.

                 reply	other threads:[~2005-08-15  9:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pan.2005.08.15.09.28.12.779733@smurf.noris.de \
    --to=smurf@smurf.noris.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox