git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Vilain <sam@vilain.net>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: [PATCH] git-svn: detect SVN::Mirror breadcrumbs on multi-init
Date: Sun, 11 Feb 2007 12:15:11 +1300	[thread overview]
Message-ID: <20070210233735.96EBF13A382@magnus.utsl.gen.nz> (raw)

SVN::Mirror leaves a little directory property on the root of its
mirrored paths to say the URL and repository UUID of the path that
this path mirrors.  If we see them, save them in the config for later
use.
---
 git-svn.perl |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 0c36e8b..59d9faf 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -358,8 +358,34 @@ sub cmd_multi_init {
 						   undef, $trunk_ref);
 		}
 	}
+	my $ra;
+	if ($url) {
+		$ra = Git::SVN::Ra->new($url);
+		my $r = $ra->get_latest_revnum;
+		my (undef, undef, $props) = $ra->get_dir('', $r);
+		if ( my $src = $props->{'svm:source'} ) {
+			# don't know wtf a ! is there for, also the
+			# username is of no interest
+			$src =~ s{!$}{};
+			$src =~ s{(^[a-z\+]*://)[^/@]*@}{$1};
+
+			# XXX - is this right?
+			my $remote_id = $Git::SVN::default_repo_id;
+			my $section = "svn-remote.$remote_id";
+
+			print STDERR "SVN::Mirror breadcrumbs detected:\n",
+			    "    $src => $url\n";
+
+			# store the source as a repo-config item
+			command_noisy('config', "$section.source", $src);
+
+			my $uuid = $props->{'svm:uuid'};
+			$uuid =~ m{^[0-9a-f\-]{30,}$}
+			    or croak "doesn't look right - svm:uuid is '$uuid'";
+			command_noisy('config', "$section.uuid", $uuid);
+		}
+	}
 	return unless defined $_branches || defined $_tags;
-	my $ra = $url ? Git::SVN::Ra->new($url) : undef;
 	complete_url_ls_init($ra, $_branches, '--branches/-b', $_prefix);
 	complete_url_ls_init($ra, $_tags, '--tags/-t', $_prefix . 'tags/');
 }
-- 
1.5.0.rc3.g3e023

                 reply	other threads:[~2007-02-10 23:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070210233735.96EBF13A382@magnus.utsl.gen.nz \
    --to=sam@vilain.net \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).