1100
sub find_parent_branch {
1101
my ($self, $paths, $rev) = @_;
1102
return undef unless $::_follow_parent;
1103
+ unless (defined $paths) {
1104
+ $self->ra->get_log([''], $rev, $rev, 0, 1, 1,
1105
+ sub { $paths = $_[0] });
1106
+ }
1107
+ return undef unless defined $paths;
1108
1109
# look for a parent from another branch:
1110
my @b_path_components = split m#/#, $self->rel_path;
1151
}
1152
my ($r0, $parent) = $gs->find_rev_before($r, 1);
1153
if ($::_follow_parent && (!defined $r0 || !defined $parent)) {
1149
- $gs->ra->get_log([$gs->{path}], 0, $r, 0, 1, 1, sub {
1150
- my ($paths, $rev) = @_;
1151
- my $log_entry = eval { $gs->do_fetch($paths, $rev) };
1152
- $gs->do_git_commit($log_entry) if $log_entry;
1153
- });
1154
+ foreach (1 .. $r) {
1155
+ if (my $log_entry = $gs->do_fetch(undef, $_)) {
1156
+ $gs->do_git_commit($log_entry);
1157
+ }
1158
+ }
1159
($r0, $parent) = $gs->last_rev_commit;
1160
}
1161
if (defined $r0 && defined $parent && $gs->revisions_eq($r0, $r)) {
1183
}
1184
not_found:
1185
print STDERR "Branch parent for path: '/",
1181
- $self->rel_path, "' not found\n";
1182
- return undef unless $paths;
1183
- foreach my $x (sort keys %$paths) {
1184
- my $p = $paths->{$x};
1185
- print STDERR ' ', $p->action, ' ', $x;
1186
- if (my $cp_from = $p->copyfrom_path) {
1187
- print STDERR "(from $cp_from:", $p->copyfrom_rev, ')';
1188
- }
1189
- print STDERR "\n";
1190
- }
1186
+ $self->rel_path, "' @ $rev not found\n";
1187
+ print STDERR ' ', $_, "\n" foreach (sort keys %$paths);
1188
return undef;
1189
}
1190
1276
my ($self, $rev, $parents, $ed) = @_;
1277
my $untracked = $self->get_untracked($ed);
1278
1279
+ return undef if ($ed->{nr} == 0 && scalar @$untracked == 0);
1280
+
1281
open my $un, '>>', "$self->{dir}/unhandled.log" or croak $!;
1282
print $un "r$rev\n" or croak $!;
1283
print $un $_, "\n" foreach @$untracked;
1295
}
1296
close $un or croak $!;
1297
1299
- delete $rp->{'svn:date'}; # this is the only revprop for r0
1300
- return undef if ($ed->{nr} == 0 && scalar @$untracked == 0 &&
1301
- scalar keys %$rp == 0);
1302
-
1298
$log_entry{date} = parse_svn_date($log_entry{date});
1299
$log_entry{author} = check_author($log_entry{author});
1300
$log_entry{log} .= "\n";
1312
my $inc = 1000;
1313
my ($min, $max) = ($base, $head < $base + $inc ? $head : $base + $inc);
1314
my $err_handler = $SVN::Error::handler;
1320
- $SVN::Error::handler = \&skip_unknown_revs;
1315
+ my $err;
1316
+ $SVN::Error::handler = sub { ($err) = @_; skip_unknown_revs($err); } ;
1317
while (1) {
1318
my @revs;
1319
$self->ra->get_log([$self->{path}], $min, $max, 0, 1, 1, sub {
1320
my ($paths, $rev, $author, $date, $log) = @_;
1321
push @revs, [ $paths, $rev ] });
1322
+ if (! @revs && $err) {
1323
+ print STDERR "Branch probably deleted:\n ",
1324
+ $err->expanded_message,
1325
+ "\nWill attempt to follow revisions ",
1326
+ "committed before the deletion\n";
1327
+ @revs = map { [ undef, $_ ] } ($min .. $max);
1328
+ }
1329
foreach (@revs) {
1330
if (my $log_entry = $self->do_fetch(@$_)) {
1331
$self->do_git_commit($log_entry, @parents);
1332
}
1333
}
1331
- last if $max >= $head;
1334
+ last if $max >= $head || $err;
1335
$min = $max + 1;
1336
$max += $inc;
1337
$max = $head if ($max > $head);
2229
sub get_log {
2230
my ($self, @args) = @_;
2231
my $pool = SVN::Pool->new;
2229
- $args[4]-- if $args[4] && ! $::_follow_parent;
2232
splice(@args, 3, 1) if ($SVN::Core::VERSION le '1.2.0');
2233
my $ret = $self->SUPER::get_log(@args, $pool);
2234
$pool->clear;