@matheusbsbs / matheus-bagliano / commits / 8cd4177d5e
Fork 0

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>

Matthias Urlichs committed Oct 10, 2005 at 14:14 UTC 8cd4177d5ef651c8acb9c1f113a076e6fae2e1c2
1 file changed +6 -5
git-svnimport.perl
+6 -5
@@ -100,8 +100,6 @@ sub new {
100 $self->{'fullrep'} = $repo;
101 $self->conn();
102
103 - $self->{'lines'} = undef;
104 -
103 return $self;
104 }
105
@@ -112,6 +110,7 @@ sub conn {
110
111 die "SVN connection to $repo: $!\n" unless defined $s;
112 $self->{'svn'} = $s;
113 + print STDERR "*** SVN *** $s ***\n";
114 $self->{'repo'} = $repo;
115 $self->{'maxrev'} = $s->get_latest_revnum();
116 }
@@ -124,13 +123,15 @@ sub file {
123 DIR => File::Spec->tmpdir(), UNLINK => 1);
124
125 print "... $rev $path ...\n" if $opt_v;
127 - eval { $self->{'svn'}->get_file($path,$rev,$fh); };
128 - if (defined $@ and $@ !~ /Attempted to get checksum/) {
126 + my $s = $self->{'svn'};
127 + print STDERR "*** GET *** $s ***\n";
128 + eval { $s->get_file($path,$rev,$fh); };
129 + if ($@ and $@ !~ /Attempted to get checksum/) {
130 # retry
131 $self->conn();
132 eval { $self->{'svn'}->get_file($path,$rev,$fh); };
133 };
133 - return () if defined $@ and $@ !~ /Attempted to get checksum/;
134 + return () if $@ and $@ !~ /Attempted to get checksum/;
135 die $@ if $@;
136 close ($fh);
137