{"thread":{"id":"43333","subject":"[PATCH 2/4] git-svn: collect SVK source URL on mirror paths","startedAt":"2006-12-04T09:35:21Z","lastAt":"2006-12-05T02:39:48Z","messageCount":2,"participants":["Sam Vilain"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"294386","messageId":"20061204235724.5393E1380C2@magnus.utsl.gen.nz","threadId":"43333","inReplyTo":null,"subject":"[PATCH 2/4] git-svn: collect SVK source URL on mirror paths","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-04T09:35:21Z","receivedAt":"2006-12-04T09:35:21Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"If you use git-svn to import a mirror path within an SVK depot\ndirectly (eg, file:///home/you/.svk/local/mirror/foo), then the URLs\nand revisions in the generated commits will be of the wrong URL.\n\nWhen we set up with git-svn multi-init, check whether the base URL is\n(the root of) a mirror path, and store it for later.  Set up a couple\nof globals and helper functions for later use.\n---\n git-svn.perl |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 93cfcc4..c5f82be 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -5,6 +5,7 @@ use warnings;\n use strict;\n use vars qw/\t$AUTHOR $VERSION\n \t\t$SVN_URL $SVN_INFO $SVN_WC $SVN_UUID\n+\t\t$SVM_URL $SVM_UUID\n \t\t$GIT_SVN_INDEX $GIT_SVN\n \t\t$GIT_DIR $GIT_SVN_DIR $REVDB/;\n $AUTHOR = 'Eric Wong <normalperson@yhbt.net>';\n@@ -733,6 +734,21 @@ sub multi_init {\n \t\tinit($_trunk);\n \t\tsys('git-repo-config', 'svn.trunk', $_trunk);\n \t}\n+\tif ( $url ) {\n+\t    # check for the case of SVK mirror path\n+\t    my ($ents, $props) = libsvn_ls_fullurl($url, \"1\");\n+\t    if ( my $src = $props->{'svm:source'} ) {\n+\t\t$src =~ s{!$}{};  # don't know wtf a ! is there for\n+\t\t$src =~ s{(^[a-z\\+]*://)[^/@]*@}{$1}; # username of no interest\n+\n+\t\t# store the source as a repo-config item\n+\t\tsys('git-repo-config', 'svn.svkmirrorpath', $src);\n+\t\tmy $uuid = $props->{'svm:uuid'};\n+\t\t$uuid =~ m{^[0-9a-f\\-]{41,}}\n+\t\t    or croak \"doesn't look right - svm:uuid is '$uuid'\";\n+\t\tsys('git-repo-config', 'svn.svkuuid', $uuid);\n+\t    }\n+\t}\n \tcomplete_url_ls_init($url, $_branches, '--branches/-b', '');\n \tcomplete_url_ls_init($url, $_tags, '--tags/-t', 'tags/');\n }\n@@ -2084,6 +2100,11 @@ sub check_repack {\n \t}\n }\n \n+sub get_svm_url {\n+    chomp($SVM_URL = `git-repo-config --get svn.svkmirrorpath`);\n+    chomp($SVM_UUID = `git-repo-config --get svn.svkuuid`);\n+}\n+\n sub set_commit_env {\n \tmy ($log_msg) = @_;\n \tmy $author = $log_msg->{author};\n-- \n1.4.4.1.ge918e-dirty\n"},{"id":"296539","messageId":"4574DBF4.8010007@vilain.net","threadId":"43333","inReplyTo":"20061204235724.5393E1380C2@magnus.utsl.gen.nz","subject":"Re: [PATCH 2/4] git-svn: collect SVK source URL on mirror paths","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T02:39:48Z","receivedAt":"2006-12-05T02:39:48Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Sam Vilain wrote:\n> +\t\tmy $uuid = $props->{'svm:uuid'};\n> +\t\t$uuid =~ m{^[0-9a-f\\-]{41,}}\n> +\t\t    or croak \"doesn't look right - svm:uuid is '$uuid'\";\n\nThis joke back-fired.  41 is too long; UUIDs just *look* longer than\nSHA1's :).  \"36\" seems a more appropriate value...\n\n"}]}