git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] git-svn: detect SVN::Mirror breadcrumbs on multi-init

From
Sam Vilain <sam@vilain.net>
Date
Feb 10, 2007, 23:15 UTC
Message-ID
<20070210233735.96EBF13A382@magnus.utsl.gen.nz>
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
Message 1 of 1 in “git-svn: detect SVN::Mirror breadcrumbs on multi-init”
  1. git-svn: detect SVN::Mirror breadcrumbs on multi-initSam Vilain, Feb 10, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.