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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]