From: Michal Sojka <sojkam1@fel.cvut.cz>
To: git@vger.kernel.org
Cc: Michal Sojka <sojkam1@fel.cvut.cz>
Subject: [PATCH/RFC] git-cvsimport: When fetching a file and an error occurs, disconnect and retry
Date: Sun, 30 Mar 2008 03:50:07 +0200 [thread overview]
Message-ID: <1206841808-24605-1-git-send-email-sojkam1@fel.cvut.cz> (raw)
I imported my repositories from CVSNT server 1.11.1.3 and on some of
them import died with error like this:
Fetching libvideo\libvideo/libvideo.dsp v 1.1.1.1
Unknown: error
After some searching I have found that the reason is probably wrong
naming of my directories (i.e. directories with the same name at
different locations). I'm not CVS guru but guess that CVS server tracks
what we are downloading and assumes that we are downloading all
subdirectories (at all levels) to one common directory. If more
subdirectories have the same name, it refuses to send the latter ones to
avoid overwriting the first one.
The dump of TCP communication was like this:
C: Argument -N
C: Argument -P
C: Argument -r
C: Argument 1.1
C: Argument --
C: Argument video/libvideo\libvideo/libvideo.dsp
C: Directory .
C: /d//cvs
C: co
S: E cvs server: existing repository d:/cvs/video/libvideo does not match d:/cvs/video/libvideo\libvideo
S: E cvs server: ignoring module video/libvideo\libvideo/libvideo.dsp
S: error
This patch solved the problem for me. When the error is received,
instead of dying immediately, the connection is closed, then opened again
and the second fetch attempt is executed.
---
git-cvsimport.perl | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 95c5eec..b33ed53 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -438,7 +438,10 @@ sub _line {
die "Unknown: $line" if $line ne "ok";
return -1;
} else {
- die "Unknown: $line\n";
+ STDOUT->flush(); # To see which file cannot be fetched
+ print STDERR "Unexpected response: $line\nDisconnecting and retrying...\n";
+ $self->{"socketo"}->close();
+ return -2;
}
}
}
@@ -453,13 +456,13 @@ sub file {
$self->_file($fn,$rev) and $res = $self->_line($fh);
- if (!defined $res) {
- print STDERR "Server has gone away while fetching $fn $rev, retrying...\n";
+ if (!defined $res || $res == -2) {
+ print STDERR "Server has gone away while fetching $fn $rev, retrying...\n" if !defined $res;
truncate $fh, 0;
$self->conn();
$self->_file($fn,$rev) or die "No file command send";
$res = $self->_line($fh);
- die "Retry failed" unless defined $res;
+ die "Retry failed" unless (defined $res && $res != -2);
}
close ($fh);
--
1.5.4.5
reply other threads:[~2008-03-30 2: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=1206841808-24605-1-git-send-email-sojkam1@fel.cvut.cz \
--to=sojkam1@fel.cvut.cz \
--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;
as well as URLs for NNTP newsgroup(s).