Skip to content

Commit

Permalink
git-svn: fix fetching new directories copies when using SVN:: libs
Browse files Browse the repository at this point in the history
Log output from SVN doesn't list all the new files that were
added if a new directory was copied from an existing place in
the repository.  This means we'll have to do some extra work and
traverse new directories ourselves.

This has been updated from the original patch to defer traversed
adds until all removals have been done.  Please disregard the
original.

Thanks to Ben Williamson for the excellent bug report and
testing.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Eric Wong authored and Junio C Hamano committed Jul 24, 2006
1 parent ce1a79b commit d0d8f7d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions git-svn.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2709,6 +2709,12 @@ sub libsvn_fetch {
} else {
die "Unrecognized action: $m, ($f r$rev)\n";
}
} elsif ($t == $SVN::Node::dir && $m =~ /^[AR]$/) {
my @traversed = ();
libsvn_traverse($gui, '', $f, $rev, \@traversed);
foreach (@traversed) {
push @amr, [ $m, $_ ]
}
}
$pool->clear;
}
Expand Down Expand Up @@ -2778,18 +2784,23 @@ sub libsvn_parse_revision {
}

sub libsvn_traverse {
my ($gui, $pfx, $path, $rev) = @_;
my ($gui, $pfx, $path, $rev, $files) = @_;
my $cwd = "$pfx/$path";
my $pool = SVN::Pool->new;
$cwd =~ s#^/+##g;
my ($dirent, $r, $props) = $SVN->get_dir($cwd, $rev, $pool);
foreach my $d (keys %$dirent) {
my $t = $dirent->{$d}->kind;
if ($t == $SVN::Node::dir) {
libsvn_traverse($gui, $cwd, $d, $rev);
libsvn_traverse($gui, $cwd, $d, $rev, $files);
} elsif ($t == $SVN::Node::file) {
print "\tA\t$cwd/$d\n" unless $_q;
libsvn_get_file($gui, "$cwd/$d", $rev);
my $file = "$cwd/$d";
if (defined $files) {
push @$files, $file;
} else {
print "\tA\t$file\n" unless $_q;
libsvn_get_file($gui, $file, $rev);
}
}
}
$pool->clear;
Expand Down Expand Up @@ -2913,9 +2924,7 @@ sub libsvn_new_tree {
}
my ($paths, $rev, $author, $date, $msg) = @_;
open my $gui, '| git-update-index -z --index-info' or croak $!;
my $pool = SVN::Pool->new;
libsvn_traverse($gui, '', $SVN_PATH, $rev, $pool);
$pool->clear;
libsvn_traverse($gui, '', $SVN_PATH, $rev);
close $gui or croak $?;
return libsvn_log_entry($rev, $author, $date, $msg);
}
Expand Down

0 comments on commit d0d8f7d

Please sign in to comment.