aboutsummaryrefslogtreecommitdiff
path: root/git-svnimport.perl
diff options
context:
space:
mode:
authorMatthias Urlichs <smurf@smurf.noris.de>2005-10-10 12:33:22 +0200
committerMatthias Urlichs <smurf@smurf.noris.de>2005-10-10 12:33:22 +0200
commit2b5e63d1b4a6f1b0ef58755a192ecb2d04e3569d (patch)
tree517065434d65403a3e475523e359ae547fdd2915 /git-svnimport.perl
parenteaf718f3ece277462de4e47391e5a965bbbaa297 (diff)
downloadgit-2b5e63d1b4a6f1b0ef58755a192ecb2d04e3569d.tar.gz
git-2b5e63d1b4a6f1b0ef58755a192ecb2d04e3569d.tar.xz
svn import: add eval()
Trying to downlaod a file that's really a subdirectory doesn't work too well. Signed-Off-By: Matthias Urlichs <smurf@smurf.noris.de>
Diffstat (limited to 'git-svnimport.perl')
-rwxr-xr-xgit-svnimport.perl16
1 files changed, 11 insertions, 5 deletions
diff --git a/git-svnimport.perl b/git-svnimport.perl
index 08645f7eb..920b23e6c 100755
--- a/git-svnimport.perl
+++ b/git-svnimport.perl
@@ -121,12 +121,15 @@ sub file {
my ($fh, $name) = tempfile('gitsvn.XXXXXX',
DIR => File::Spec->tmpdir(), UNLINK => 1);
- $self->{'svn'}->get_file($path,$rev,$fh) or do {
+ print "... $rev $path ...\n" if $opt_v;
+ eval { $self->{'svn'}->get_file($path,$rev,$fh); };
+ if (defined $@ and $@ !~ /Attempted to get checksum/) {
# retry
$self->conn();
- $self->{'svn'}->get_file($path,$rev,$fh)
- or die "$rev: No file $path at $rev\n";
+ eval { $self->{'svn'}->get_file($path,$rev,$fh); };
};
+ return () if defined $@ and $@ !~ /Attempted to get checksum/;
+ die $@ if $@;
close ($fh);
return ($name, $res);
@@ -308,7 +311,8 @@ sub get_file($$$) {
}
# now get it
- my ($name, $res) = $svn->file($svnpath,$rev);
+ my ($name, $res) = eval { $svn->file($svnpath,$rev); };
+ return () unless defined $name;
open my $F, '-|', "git-hash-object -w $name"
or die "Cannot create object: $!\n";
@@ -343,7 +347,9 @@ sub commit {
my($author_name,$author_email,$dest);
my(@old,@new);
- if ($author =~ /^(.*?)\s+<(.*)>$/) {
+ if (not defined $author) {
+ $author_name = $author_email = "unknown";
+ } elsif ($author =~ /^(.*?)\s+<(.*)>$/) {
($author_name, $author_email) = ($1, $2);
} else {
$author =~ s/^<(.*)>$/$1/;