author | Junio C Hamano <junkio@cox.net> | |
Sun, 3 Dec 2006 01:26:58 +0000 (17:26 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 3 Dec 2006 01:26:58 +0000 (17:26 -0800) |
* maint:
git-svn: avoid fetching files twice in the same revision
git-svn: avoid fetching files twice in the same revision
1 | 2 | |||
---|---|---|---|---|
git-svn.perl | patch | | diff1 | | diff2 | | blob | history |
diff --cc git-svn.perl
index 3891122d73c6f76f41f31cc6280f9d6c40581d62,b53273eaea77c80fbfc3e1791a5eeab16c1b4c7e..d0bd0bdeb8462f7ad4550b5fe406f4e0a1a0ee1c
--- 1/git-svn.perl
--- 2/git-svn.perl
+++ b/git-svn.perl
}
sub libsvn_fetch {
+ $_xfer_delta ? libsvn_fetch_delta(@_) : libsvn_fetch_full(@_);
+}
+
+sub libsvn_fetch_delta {
+ my ($last_commit, $paths, $rev, $author, $date, $msg) = @_;
+ my $pool = SVN::Pool->new;
+ my $ed = SVN::Git::Fetcher->new({ c => $last_commit, q => $_q });
+ my $reporter = $SVN->do_update($rev, '', 1, $ed, $pool);
+ my @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();
+ my (undef, $last_rev, undef) = cmt_metadata($last_commit);
+ $reporter->set_path('', $last_rev, 0, @lock, $pool);
+ $reporter->finish_report($pool);
+ $pool->clear;
+ unless ($ed->{git_commit_ok}) {
+ die "SVN connection failed somewhere...\n";
+ }
+ libsvn_log_entry($rev, $author, $date, $msg, [$last_commit]);
+}
+
+sub libsvn_fetch_full {
my ($last_commit, $paths, $rev, $author, $date, $msg) = @_;
open my $gui, '| git-update-index -z --index-info' or croak $!;
- my @amr;
+ my %amr;
+ my $p = $SVN->{svn_path};
foreach my $f (keys %$paths) {
my $m = $paths->{$f}->action();
- $f =~ s#^/+##;
+ if (length $p) {
+ $f =~ s#^/\Q$p\E/##;
+ next if $f =~ m#^/#;
+ } else {
+ $f =~ s#^/##;
+ }
if ($m =~ /^[DR]$/) {
- print "\t$m\t$f\n" unless $_q;
- process_rm($gui, $last_commit, $f);
+ process_rm($gui, $last_commit, $f, $_q);
next if $m eq 'D';
# 'R' can be file replacements, too, right?
}