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

[PATCH 3/5] git-svn: collect SVK source URL on mirror paths

From
Sam Vilain <sam@vilain.net>
Date
Dec 5, 2006, 05:17 UTC
Message-ID
<20061205051738.16552.99307.stgit@localhost>
In-Reply-To
<20061205051738.16552.8987.stgit@localhost>
From: Sam Vilain <sam@vilain.net>

If you use git-svn to import a mirror path within an SVK depot directly (eg, file:///home/you/.svk/local/mirror/foo), then the URLs and revisions in the generated commits will be of the wrong URL.

When we set up with git-svn multi-init, check whether the base URL is (the root of) a mirror path, and store it for later. Set up a couple of globals and helper functions for later use. ---

 git-svn.perl |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 93cfcc4..800c579 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -5,6 +5,7 @@ use warnings;
 use strict;
 use vars qw/	$AUTHOR $VERSION
 		$SVN_URL $SVN_INFO $SVN_WC $SVN_UUID
+		$SVM_URL $SVM_UUID
 		$GIT_SVN_INDEX $GIT_SVN
 		$GIT_DIR $GIT_SVN_DIR $REVDB/;
 $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';
@@ -733,6 +734,21 @@ sub multi_init {
 		init($_trunk);
 		sys('git-repo-config', 'svn.trunk', $_trunk);
 	}
+	if ( $url ) {
+		# check for the case of SVK mirror path
+		my ($ents, $props) = libsvn_ls_fullurl($url, "1");
+		if ( my $src = $props->{'svm:source'} ) {
+			$src =~ s{!$}{};  # don't know wtf a ! is there for
+			$src =~ s{(^[a-z\+]*://)[^/@]*@}{$1}; # username of no interest
+
+			# store the source as a repo-config item
+			sys('git-repo-config', 'svn.svkmirrorpath', $src);
+			my $uuid = $props->{'svm:uuid'};
+			$uuid =~ m{^[0-9a-f\-]{36,}}
+				or croak "doesn't look right - svm:uuid is '$uuid'";
+			sys('git-repo-config', 'svn.svkuuid', $uuid);
+		}
+	}
 	complete_url_ls_init($url, $_branches, '--branches/-b', '');
 	complete_url_ls_init($url, $_tags, '--tags/-t', 'tags/');
 }
@@ -2084,6 +2100,11 @@ sub check_repack {
 	}
 }
 
+sub get_svm_url {
+	chomp($SVM_URL = `git-repo-config --get svn.svkmirrorpath`);
+	chomp($SVM_UUID = `git-repo-config --get svn.svkuuid`);
+}
+
 sub set_commit_env {
 	my ($log_msg) = @_;
 	my $author = $log_msg->{author};
Previous: Sam VilainNext: Eric Wong
Message 9 of 11 in “git-svn: make test for SVK mirror path import”
  1. 1/5 git-svn: make test for SVK mirror path importSam Vilain, Dec 5, 2006
  2. 4/5 git-svn: collect revision properties when fetchingSam Vilain, Dec 5, 2006
  3. 5/5 git-svn: re-map repository URLs and UUIDs on SVK mirror pathsSam Vilain, Dec 5, 2006
  4. Eric WongDec 5, 2006
  5. Sam VilainDec 7, 2006
  6. Eric WongDec 7, 2006
  7. git-svn: use do_switch for --follow-parent if the SVN library supports itEric Wong, Dec 8, 2006
  8. 2/5 git-svn: let libsvn_ls_fullurl return properties tooSam Vilain, Dec 5, 2006
  9. 3/5 git-svn: collect SVK source URL on mirror pathsSam Vilain, Dec 5, 2006
  10. Eric WongDec 5, 2006
  11. Jakub NarebskiDec 5, 2006

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.