svn import: avoid reconnecting

Perl's eval() sets $@ to empts, not undef, when it succeeds.
That caused excessive reconnect attempts.

Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
This commit is contained in:
Matthias Urlichs 2005-10-10 14:14:44 +02:00
parent 37dcf6de60
commit 8cd4177d5e

View File

@ -100,8 +100,6 @@ sub new {
$self->{'fullrep'} = $repo; $self->{'fullrep'} = $repo;
$self->conn(); $self->conn();
$self->{'lines'} = undef;
return $self; return $self;
} }
@ -112,6 +110,7 @@ sub conn {
die "SVN connection to $repo: $!\n" unless defined $s; die "SVN connection to $repo: $!\n" unless defined $s;
$self->{'svn'} = $s; $self->{'svn'} = $s;
print STDERR "*** SVN *** $s ***\n";
$self->{'repo'} = $repo; $self->{'repo'} = $repo;
$self->{'maxrev'} = $s->get_latest_revnum(); $self->{'maxrev'} = $s->get_latest_revnum();
} }
@ -124,13 +123,15 @@ sub file {
DIR => File::Spec->tmpdir(), UNLINK => 1); DIR => File::Spec->tmpdir(), UNLINK => 1);
print "... $rev $path ...\n" if $opt_v; print "... $rev $path ...\n" if $opt_v;
eval { $self->{'svn'}->get_file($path,$rev,$fh); }; my $s = $self->{'svn'};
if (defined $@ and $@ !~ /Attempted to get checksum/) { print STDERR "*** GET *** $s ***\n";
eval { $s->get_file($path,$rev,$fh); };
if ($@ and $@ !~ /Attempted to get checksum/) {
# retry # retry
$self->conn(); $self->conn();
eval { $self->{'svn'}->get_file($path,$rev,$fh); }; eval { $self->{'svn'}->get_file($path,$rev,$fh); };
}; };
return () if defined $@ and $@ !~ /Attempted to get checksum/; return () if $@ and $@ !~ /Attempted to get checksum/;
die $@ if $@; die $@ if $@;
close ($fh); close ($fh);