summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-01-29 09:18:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-06 21:50:21 (GMT)
commitc586879cdfa4f8181a14e953a9152a4639eef333 (patch)
tree2065e342127e6ebdce4d5f652391267ba85affc4 /git-svn.perl
parent7deaec9ac7bb42da0ee40da66f663b0d589ce7ee (diff)
downloadgit-c586879cdfa4f8181a14e953a9152a4639eef333.zip
git-c586879cdfa4f8181a14e953a9152a4639eef333.tar.gz
git-c586879cdfa4f8181a14e953a9152a4639eef333.tar.bz2
git-svn: improve repository URL matching when following parents
This way we can avoid the spawning of a new SVN::Ra session by reusing the existing one. The most problematic issue is that some svn servers disallow too many connections from a single IP, so this will allow git-svn to fetch from those repositories with a higher success rate by using fewer connections. This sometimes showed up as a new (and redundant) [svn-remote "$parent_refname"] entry in $GIT_DIR/svn/.metadata. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 6cc3157..7889cce 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2229,7 +2229,12 @@ sub find_parent_branch {
# just grow a tail if we're not unique enough :x
$ref_id .= '-' while find_ref($ref_id);
print STDERR "Initializing parent: $ref_id\n";
- $gs = Git::SVN->init($new_url, '', $ref_id, $ref_id, 1);
+ my ($u, $p) = ($new_url, '');
+ if ($u =~ s#^\Q$url\E(/|$)##) {
+ $p = $u;
+ $u = $url;
+ }
+ $gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1);
}
my ($r0, $parent) = $gs->find_rev_before($r, 1);
if (!defined $r0 || !defined $parent) {