All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: git@vger.kernel.org
Subject: [PATCH] git-svn: improve repository URL matching when following parents
Date: Tue, 29 Jan 2008 01:18:58 -0800	[thread overview]
Message-ID: <20080129091858.GA4569@soma> (raw)

Warning!  This patch isn't heavily-tested against remote
servers, it only helped me limp by on a server I was having
trouble with tonight.  I was barely awake when working on this
and have been living in a different timezone for more than a
week, so don't trust it too much unless you're already having
difficulty with some servers.

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>
---

 Note: there are still cases where git-svn can open more than
 one connection to the SVN server, which can make some SVN
 setups/administrators unhappy.  Unfortunately, I'm pretty sure
 I won't have time to properly fix all of these in the next few
 days.

 For now, if you get "connection closed unexpectedly" messages
 while fetching (and following parents), just restart git-svn
 and it'll pick up where it left off.

 git-svn.perl |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 75e97cc..7ba8c8f 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2226,7 +2226,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) {
-- 
Eric Wong

             reply	other threads:[~2008-01-29  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29  9:18 Eric Wong [this message]
2008-02-05  8:53 ` [PATCH] git-svn: improve repository URL matching when following parents Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080129091858.GA4569@soma \
    --to=normalperson@yhbt.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.