{"thread":{"id":"43356","subject":"Re: [PATCH 1/5] git-svn: make test for SVK mirror path import","startedAt":"2006-12-05T05:17:38Z","lastAt":"2006-12-08T10:20:17Z","messageCount":11,"participants":["Jakub Narebski","Sam Vilain","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"295281","messageId":"20061205051738.16552.36012.stgit@localhost","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"[PATCH 4/5] git-svn: collect revision properties when fetching","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T05:17:38Z","receivedAt":"2006-12-05T05:17:38Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nPerhaps there is information in the \"revision properties\" (unversioned\nmetadata associated with commits) that will affect the way that we\nsave the revision.  Collect them.\n---\nSorry for the long lines.\n\n git-svn.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 800c579..70c34b0 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -441,12 +441,16 @@ sub fetch_lib {\n \t\t\t\t\tif ($last_commit) {\n \t\t\t\t\t\t$log_msg = libsvn_fetch(\n \t\t\t\t\t\t\t$last_commit, @_);\n+\t\t\t\t\t\t$log_msg->{revprops}\n+\t\t\t\t\t\t\t= $SVN->rev_proplist($log_msg->{revision});\n \t\t\t\t\t\t$last_commit = git_commit(\n \t\t\t\t\t\t\t$log_msg,\n \t\t\t\t\t\t\t$last_commit,\n \t\t\t\t\t\t\t@parents);\n \t\t\t\t\t} else {\n \t\t\t\t\t\t$log_msg = libsvn_new_tree(@_);\n+\t\t\t\t\t\t$log_msg->{revprops}\n+\t\t\t\t\t\t\t= $SVN->rev_proplist($log_msg->{revision});\n \t\t\t\t\t\t$last_commit = git_commit(\n \t\t\t\t\t\t\t$log_msg, @parents);\n \t\t\t\t\t}\n"},{"id":"295843","messageId":"20061205051738.16552.22494.stgit@localhost","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"[PATCH 5/5] git-svn: re-map repository URLs and UUIDs on SVK mirror paths","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T05:17:38Z","receivedAt":"2006-12-05T05:17:38Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nIf an SVN revision has a property, \"svm:headrev\", it is likely that\nthe revision was created by \"svk sync\".  The property contains a\nrepository UUID and a revision.  We want to make it look like we are\nmirroring the original URL, so introduce a helper function that\nreturns the original identity trio, and use it when generating commit\nmessages and dummy e-mail domains.\n---\n\n git-svn.perl |   31 +++++++++++++++++++++++++++----\n 1 files changed, 27 insertions(+), 4 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 70c34b0..13a1f24 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2076,8 +2076,9 @@ sub git_commit {\n \t\t\t\t\t\t\t\tor croak $!;\n \tprint $msg_fh $log_msg->{msg} or croak $!;\n \tunless ($_no_metadata) {\n-\t\tprint $msg_fh \"\\ngit-svn-id: $SVN_URL\\@$log_msg->{revision}\",\n-\t\t\t\t\t\" $SVN_UUID\\n\" or croak $!;\n+\t\tmy ($url, $uuid, $rev) = svn_commit_id($log_msg);\n+\t\tprint $msg_fh \"\\ngit-svn-id: $url\\@$rev $uuid\\n\"\n+\t\t\tor croak $!;\n \t}\n \t$msg_fh->flush == 0 or croak $!;\n \tclose $msg_fh or croak $!;\n@@ -2109,14 +2110,36 @@ sub get_svm_url {\n \tchomp($SVM_UUID = `git-repo-config --get svn.svkuuid`);\n }\n \n+sub svn_commit_id {\n+\tmy $log_msg = shift;\n+\tmy ($url, $uuid, $rev) = ($SVN_URL, $SVN_UUID, $log_msg->{revision});\n+\tmy $svm_headrev = $log_msg->{revprops}{'svm:headrev'};\n+\tif ( $svm_headrev ) {\n+\t\tmy ( $_uuid, $_rev) = split /:/, $svm_headrev;\n+\t\tchomp($_rev);\n+\t\tif ( !$SVM_URL ) {\n+\t\t\tget_svm_url();\n+\t\t}\n+\t\tif ( $_uuid ne $SVM_UUID ) {\n+\t\t\twarn \"$uuid:$rev claims to be $_uuid:$_rev, but that's unknown\";\n+\t\t} else {\n+\t\t\t($url, $uuid, $rev) = ($SVM_URL, $SVM_UUID, $_rev);\n+\t\t}\n+\t}\n+\t($url, $uuid, $rev);\n+}\n+\n sub set_commit_env {\n \tmy ($log_msg) = @_;\n \tmy $author = $log_msg->{author};\n \tif (!defined $author || length $author == 0) {\n \t\t$author = '(no author)';\n \t}\n-\tmy ($name,$email) = defined $users{$author} ?  @{$users{$author}}\n-\t\t\t\t: ($author,\"$author\\@$SVN_UUID\");\n+\tmy ($name,$email) = defined $users{$author} ? @{$users{$author}}\n+\t\t: do {\n+\t\t\tmy (undef, $uuid, undef) = svn_commit_id($log_msg);\n+\t\t\t($author,\"$author\\@$uuid\")\n+\t\t};\n \t$ENV{GIT_AUTHOR_NAME} = $ENV{GIT_COMMITTER_NAME} = $name;\n \t$ENV{GIT_AUTHOR_EMAIL} = $ENV{GIT_COMMITTER_EMAIL} = $email;\n \t$ENV{GIT_AUTHOR_DATE} = $ENV{GIT_COMMITTER_DATE} = $log_msg->{date};\n"},{"id":"295930","messageId":"20061205051738.16552.59004.stgit@localhost","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"[PATCH 2/5] git-svn: let libsvn_ls_fullurl return properties too","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T05:17:38Z","receivedAt":"2006-12-05T05:17:38Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nAllow an extra parameter to be passed to the libsvn_ls_fullurl\nfunction to collect and return the properties of the URL being listed.\n---\n\n git-svn.perl |    7 ++++---\n 1 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 3891122..93cfcc4 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3321,18 +3321,19 @@ sub libsvn_commit_cb {\n \n sub libsvn_ls_fullurl {\n \tmy $fullurl = shift;\n+\tmy $want_props = shift;\n \tmy $ra = libsvn_connect($fullurl);\n-\tmy @ret;\n+\tmy (@ret, @props);\n \tmy $pool = SVN::Pool->new;\n \tmy $r = defined $_revision ? $_revision : $ra->get_latest_revnum;\n-\tmy ($dirent, undef, undef) = $ra->get_dir('', $r, $pool);\n+\tmy ($dirent, undef, $props) = $ra->get_dir('', $r, $pool);\n \tforeach my $d (keys %$dirent) {\n \t\tif ($dirent->{$d}->kind == $SVN::Node::dir) {\n \t\t\tpush @ret, \"$d/\"; # add '/' for compat with cli svn\n \t\t}\n \t}\n \t$pool->clear;\n-\treturn @ret;\n+\treturn ($want_props ? (\\@ret, $props) : @ret);\n }\n \n \n"},{"id":"298540","messageId":"20061205051738.16552.99307.stgit@localhost","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"[PATCH 3/5] git-svn: collect SVK source URL on mirror paths","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T05:17:38Z","receivedAt":"2006-12-05T05:17:38Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From: Sam Vilain <sam@vilain.net>\n\nIf 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\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..800c579 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\t# check for the case of SVK mirror path\n+\t\tmy ($ents, $props) = libsvn_ls_fullurl($url, \"1\");\n+\t\tif ( my $src = $props->{'svm:source'} ) {\n+\t\t\t$src =~ s{!$}{};  # don't know wtf a ! is there for\n+\t\t\t$src =~ s{(^[a-z\\+]*://)[^/@]*@}{$1}; # username of no interest\n+\n+\t\t\t# store the source as a repo-config item\n+\t\t\tsys('git-repo-config', 'svn.svkmirrorpath', $src);\n+\t\t\tmy $uuid = $props->{'svm:uuid'};\n+\t\t\t$uuid =~ m{^[0-9a-f\\-]{36,}}\n+\t\t\t\tor croak \"doesn't look right - svm:uuid is '$uuid'\";\n+\t\t\tsys('git-repo-config', 'svn.svkuuid', $uuid);\n+\t\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+\tchomp($SVM_URL = `git-repo-config --get svn.svkmirrorpath`);\n+\tchomp($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"},{"id":"298574","messageId":"20061205051738.16552.8987.stgit@localhost","threadId":"43356","inReplyTo":null,"subject":"[PATCH 1/5] git-svn: make test for SVK mirror path import","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-05T05:17:38Z","receivedAt":"2006-12-05T05:17:38Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"From:  <sam@vilain.net>\n\nA manual test that sets up a repository that looks like an SVK depot,\nand then imports it to check that it looks like we mirrored the\n'original' source.\n\nThere is also a minor modification to the git-svn test library shell\nfile which sets a variable for the subversion repository's filesystem\npath.\n---\n\n t/lib-git-svn.sh                   |    3 -\n t/t9107-git-svn-svk-mirrorpaths.sh |   92 ++++++++++++++++++++++++++++++++++++\n 2 files changed, 93 insertions(+), 2 deletions(-)\n\ndiff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh\nindex 63c6703..dffd1fb 100644\n--- a/t/lib-git-svn.sh\n+++ b/t/lib-git-svn.sh\n@@ -45,6 +45,5 @@ else\n \tsvnadmin create \"$svnrepo\"\n fi\n \n+rawsvnrepo=\"$svnrepo\"\n svnrepo=\"file://$svnrepo\"\n-\n-\ndiff --git a/t/t9107-git-svn-svk-mirrorpaths.sh b/t/t9107-git-svn-svk-mirrorpaths.sh\nnew file mode 100755\nindex 0000000..130e786\n--- /dev/null\n+++ b/t/t9107-git-svn-svk-mirrorpaths.sh\n@@ -0,0 +1,92 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2006 Eric Wong\n+#\n+\n+test_description='git-svn on SVK mirror paths'\n+. ./lib-git-svn.sh\n+\n+if test -n \"$GIT_SVN_NO_LIB\" && test \"$GIT_SVN_NO_LIB\" -ne 0\n+then\n+\techo 'Skipping: only implemented with SVN libraries'\n+\ttest_done\n+\texit 0\n+fi\n+\n+# ok, people who don't have SVK installed probably don't care about\n+# this test.\n+\n+# we set up the repository manually, because even if SVK is installed\n+# it is difficult to use it in a way that is idempotent.\n+\n+# we are not yet testing merge tickets..\n+\n+uuid=b00bface-b1ff-c0ff-f0ff-b0bafe775e1e \n+url=https://really.slow.server.com/foobar \n+\n+test_expect_success 'initialize repo' \"\n+\techo '#!/bin/sh' > $rawsvnrepo/hooks/pre-revprop-change &&\n+\techo 'exit 0' >> $rawsvnrepo/hooks/pre-revprop-change &&\n+\tchmod +x $rawsvnrepo/hooks/pre-revprop-change &&\n+\n+\tmkdir import &&\n+\tcd import &&\n+\tmkdir local &&\n+\techo hello > local/readme &&\n+\tsvn import -m 'random local work' . $svnrepo &&\n+\tcd .. &&\n+\n+\tsvn co $svnrepo wc &&\n+\tcd wc &&\n+\tmkdir -p mirror/foobar &&\n+        svn add mirror &&\n+\tsvn ps svm:source $url mirror/foobar &&\n+\tsvn ps svm:uuid $uuid mirror/foobar &&\n+\tsvn ps svm:mirror mirror/foobar . &&\n+\tsvn commit -m 'setup mirror/foobar as mirror of upstream' &&\n+\tsvn ps -r 2 --revprop svm:headrev $uuid:0 $svnrepo &&\n+\n+        mkdir mirror/foobar/trunk\n+\techo hello, world > mirror/foobar/trunk/readme &&\n+\tsvn add mirror/foobar/trunk &&\n+\tsvn commit -m 'first upstream revision' &&\n+\tsvn ps -r 3 --revprop svm:headrev $uuid:1 $svnrepo &&\n+\n+\tsvn up &&\n+        svn mkdir mirror/foobar/branches &&\n+\tsvn cp mirror/foobar/trunk mirror/foobar/branches/silly &&\n+        svn commit -m 'make branch for silliness' &&\n+\tsvn ps -r 4 --revprop svm:headrev $uuid:2 $svnrepo &&\n+\n+\tsvn up &&\n+\techo random untested feature >> mirror/foobar/trunk/readme &&\n+\tsvn commit -m 'add a c00l feature to trunk' &&\n+\tsvn ps -r 5 --revprop svm:headrev $uuid:3 $svnrepo &&\n+\n+\tsvn up &&\n+\techo bug fix >> mirror/foobar/branches/silly/readme &&\n+\tsvn commit -m 'fix a bug' &&\n+\tsvn ps -r 6 --revprop svm:headrev $uuid:4 $svnrepo &&\n+\n+        svn mkdir mirror/foobar/tags &&\n+\tsvn cp mirror/foobar/branches/silly mirror/foobar/tags/blah-1.0 &&\n+        svn commit -m 'make a release' &&\n+\tsvn ps -r 7 --revprop svm:headrev $uuid:5 $svnrepo &&\n+\n+\tcd ..\n+\t\"\n+\n+test_expect_success 'multi-init an SVK mirror path' \"git-svn multi-init -t tags -b branches $svnrepo/mirror/foobar\"\n+\n+test_expect_success 'multi-fetch an SVK mirror path' \"git-svn multi-fetch\"\n+\n+test_expect_success 'got tag history OK' \"test \\`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l \\` = 3\"\n+\n+test_expect_success 're-wrote git-svn-id URL' \"git-show HEAD | grep git-svn-id: | fgrep $url\"\n+test_expect_success 're-wrote git-svn-id UUID' \"git-show HEAD | grep git-svn-id: | fgrep $uuid\"\n+test_expect_success 're-wrote git-svn-id revision' \"git-show HEAD | grep git-svn-id: | fgrep '@3'\"\n+test_expect_success 're-wrote author e-mail domain UUID' \"test \\`git-show --pretty=fuller HEAD | grep '<.*@.*>' | fgrep $uuid | wc -l\\` = 2\"\n+\n+test_debug 'gitk --all &'\n+\n+test_done\n"},{"id":"295668","messageId":"20061205084005.GA27236@soma","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"Re: [PATCH 1/5] git-svn: make test for SVK mirror path import","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-05T08:40:05Z","receivedAt":"2006-12-05T08:40:05Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Sam Vilain <sam@vilain.net> wrote:\n> From:  <sam@vilain.net>\n> \n> A manual test that sets up a repository that looks like an SVK depot,\n> and then imports it to check that it looks like we mirrored the\n> 'original' source.\n> \n> There is also a minor modification to the git-svn test library shell\n> file which sets a variable for the subversion repository's filesystem\n> path.\n> ---\n> \n>  t/lib-git-svn.sh                   |    3 -\n>  t/t9107-git-svn-svk-mirrorpaths.sh |   92 ++++++++++++++++++++++++++++++++++++\n>  2 files changed, 93 insertions(+), 2 deletions(-)\n> \n> diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh\n> index 63c6703..dffd1fb 100644\n> --- a/t/lib-git-svn.sh\n> +++ b/t/lib-git-svn.sh\n> @@ -45,6 +45,5 @@ else\n>  \tsvnadmin create \"$svnrepo\"\n>  fi\n>  \n> +rawsvnrepo=\"$svnrepo\"\n>  svnrepo=\"file://$svnrepo\"\n> -\n> -\n> diff --git a/t/t9107-git-svn-svk-mirrorpaths.sh b/t/t9107-git-svn-svk-mirrorpaths.sh\n> new file mode 100755\n> index 0000000..130e786\n> --- /dev/null\n> +++ b/t/t9107-git-svn-svk-mirrorpaths.sh\n> @@ -0,0 +1,92 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2006 Eric Wong\n\nHuh? I didn't write this test.\n\n> +test_description='git-svn on SVK mirror paths'\n> +. ./lib-git-svn.sh\n> +\n> +if test -n \"$GIT_SVN_NO_LIB\" && test \"$GIT_SVN_NO_LIB\" -ne 0\n> +then\n> +\techo 'Skipping: only implemented with SVN libraries'\n> +\ttest_done\n> +\texit 0\n> +fi\n> +\n> +# ok, people who don't have SVK installed probably don't care about\n> +# this test.\n> +\n> +# we set up the repository manually, because even if SVK is installed\n> +# it is difficult to use it in a way that is idempotent.\n> +\n> +# we are not yet testing merge tickets..\n> +\n> +uuid=b00bface-b1ff-c0ff-f0ff-b0bafe775e1e \n> +url=https://really.slow.server.com/foobar \n\nI had to use --whitespace=strip with git-am above.\n\n> +test_expect_success 'multi-fetch an SVK mirror path' \"git-svn multi-fetch\"\n\nI had to use the following patch to get the multi-fetch test to pass\nwith GIT_SVN_DELTA_FETCH=1. (I discovered it while running make -C t\nfull-svn-test)\n\nIs it safe to assume that svk-mirrored URLs will _always_ be file://?\nIf so, then the delta fetching code should never be needed.\n\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3017,8 +3017,7 @@ sub libsvn_fetch_delta {\n \tmy $ed = SVN::Git::Fetcher->new({ c => $last_commit, q => $_q });\n \tmy $reporter = $SVN->do_update($rev, '', 1, $ed, $pool);\n \tmy @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();\n-\tmy (undef, $last_rev, undef) = cmt_metadata($last_commit);\n-\t$reporter->set_path('', $last_rev, 0, @lock, $pool);\n+\t$reporter->set_path('', ($rev - 1), 0, @lock, $pool);\n \t$reporter->finish_report($pool);\n \t$pool->clear;\n \tunless ($ed->{git_commit_ok}) {\n\nAlso, unconditionally setting ($rev - 1) in the above patch disables the\nability to do squashed history[1] imports (not sure if anybody cares about\nthem, though).\n\n[1] - like shallow clone, but shallow in the middle of history\n\n> +test_expect_success 'got tag history OK' \"test \\`git-log --pretty=oneline remotes/tags/blah-1.0 | wc -l \\` = 3\"\n\nBut the above test breaks this one...\n\n-- \n"},{"id":"297874","messageId":"20061205085804.GB27236@soma","threadId":"43356","inReplyTo":"20061205051738.16552.22494.stgit@localhost","subject":"Re: [PATCH 5/5] git-svn: re-map repository URLs and UUIDs on SVK mirror paths","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-05T08:58:04Z","receivedAt":"2006-12-05T08:58:04Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Sam Vilain <sam@vilain.net> wrote:\n> From: Sam Vilain <sam@vilain.net>\n> \n> If an SVN revision has a property, \"svm:headrev\", it is likely that\n> the revision was created by \"svk sync\".  The property contains a\n> repository UUID and a revision.  We want to make it look like we are\n> mirroring the original URL, so introduce a helper function that\n> returns the original identity trio, and use it when generating commit\n> messages and dummy e-mail domains.\n\nUpon further review, this would make 'git svn rebuild' behave\nunexpectedly (it would make the git-svn metadata, including .rev_db\nentries point to the original repo and not the SVK one).  This may not\nnecessarily be a big deal, however.\n\nAlso, incremental fetches (or fetching more than 1k sequential\nrevisions) would probably fail.  To fix this, read the offset of last\nentry in .rev_db instead of git-svn-id: from the last commit to get the\nlast revision.  But since rebuild won't work as expected; losing the\n.rev_db file means you wouldn't be able to fetch from the SVK repo\nanymore (but the original upstream one will be fine).\n\nOne last thing: feature should be made optional.  I actually work\nday-to-day on a repository that was created with svm/SVN::Mirror,\nthe original repository no longer exists; but the mirrored one\nstill has these properties (I suppose I could remove the props\nserver-side, but some people may not have the permissions).\n\n-- \n"},{"id":"294475","messageId":"el3hon$9kn$1@sea.gmane.org","threadId":"43356","inReplyTo":"20061205051738.16552.8987.stgit@localhost","subject":"Re: [PATCH 1/5] git-svn: make test for SVK mirror path import","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-12-05T10:32:52Z","receivedAt":"2006-12-05T10:32:52Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Sam Vilain wrote:\n^^^^^^^^^^\n\n> From: <sam@vilain.net>\n[...]\n> diff --git a/t/t9107-git-svn-svk-mirrorpaths.sh\nb/t/t9107-git-svn-svk-mirrorpaths.sh\n> new file mode 100755\n> index 0000000..130e786\n> --- /dev/null\n> +++ b/t/t9107-git-svn-svk-mirrorpaths.sh\n[...]\n> +# Copyright (c) 2006 Eric Wong\n                        ^^^^^^^^^\n???\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n\n"},{"id":"294535","messageId":"45775E52.90102@vilain.net","threadId":"43356","inReplyTo":"20061205085804.GB27236@soma","subject":"Re: [PATCH 5/5] git-svn: re-map repository URLs and UUIDs on SVK mirror paths","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2006-12-07T00:20:34Z","receivedAt":"2006-12-07T00:20:34Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Eric Wong wrote:\n> Upon further review, this would make 'git svn rebuild' behave\n> unexpectedly (it would make the git-svn metadata, including .rev_db\n> entries point to the original repo and not the SVK one).  This may not\n> necessarily be a big deal, however.\n\nYes, that's the idea; a 'rebuild' should set it up to pull from the\noriginal SVN repository directly.  That probably needs some documentation...\n\n> Also, incremental fetches (or fetching more than 1k sequential\n> revisions) would probably fail.  To fix this, read the offset of last\n> entry in .rev_db instead of git-svn-id: from the last commit to get the\n> last revision.  But since rebuild won't work as expected; losing the\n> .rev_db file means you wouldn't be able to fetch from the SVK repo\n> anymore (but the original upstream one will be fine).\n> \n> One last thing: feature should be made optional.  I actually work\n> day-to-day on a repository that was created with svm/SVN::Mirror,\n> the original repository no longer exists; but the mirrored one\n> still has these properties (I suppose I could remove the props\n> server-side, but some people may not have the permissions).\n\nok, I'll work on that and the other issues you highlighted... possibly\nthe overhead of fetching the revprops during mirroring might hurt a\nlittle for people not doing this, too.  Thanks for reviewing the patch!\n\nSam.\n\n\n"},{"id":"296345","messageId":"20061207200236.GB8179@localdomain","threadId":"43356","inReplyTo":"45775E52.90102@vilain.net","subject":"Re: [PATCH 5/5] git-svn: re-map repository URLs and UUIDs on SVK mirror paths","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-07T20:02:37Z","receivedAt":"2006-12-07T20:02:37Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Sam Vilain <sam@vilain.net> wrote:\n> Eric Wong wrote:\n> > Also, incremental fetches (or fetching more than 1k sequential\n> > revisions) would probably fail.  To fix this, read the offset of last\n> > entry in .rev_db instead of git-svn-id: from the last commit to get the\n> > last revision.  But since rebuild won't work as expected; losing the\n> > .rev_db file means you wouldn't be able to fetch from the SVK repo\n> > anymore (but the original upstream one will be fine).\n> > \n> > One last thing: feature should be made optional.  I actually work\n> > day-to-day on a repository that was created with svm/SVN::Mirror,\n> > the original repository no longer exists; but the mirrored one\n> > still has these properties (I suppose I could remove the props\n> > server-side, but some people may not have the permissions).\n> \n> ok, I'll work on that and the other issues you highlighted... possibly\n> the overhead of fetching the revprops during mirroring might hurt a\n> little for people not doing this, too.  Thanks for reviewing the patch!\n\nFor the git-svn in master using the delta fetcher; there's no additional\noverhead to fetch properties.  I want to ditch the old non-delta\nfetching code (it's only a mild performance benefit when using local\nrepositories) if I could get do_switch() working correctly.\n\n-- \n"},{"id":"295558","messageId":"20061208102017.GA30955@soma","threadId":"43356","inReplyTo":"20061207200236.GB8179@localdomain","subject":"[PATCH] git-svn: use do_switch for --follow-parent if the SVN library supports it","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-12-08T10:20:17Z","receivedAt":"2006-12-08T10:20:17Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"do_switch works with the SVN Perl bindings after r22312 in the\nSubversion trunk.  Since no released version of SVN currently\nsupports it; we'll just autodetect it and enable its usage\nwhen a user has a recent-enough version of SVN.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\nEric Wong <normalperson@yhbt.net> wrote:\n> For the git-svn in master using the delta fetcher; there's no additional\n> overhead to fetch properties.  I want to ditch the old non-delta\n> fetching code (it's only a mild performance benefit when using local\n> repositories) if I could get do_switch() working correctly.\n\n I don't think I can ditch the old code anytime soon.  I was tempted to\n try using do_diff, but it appears SVN downloads the entire files (using\n get_file) and generates the diffs locally, negating any bandwidth\n saving it would have over the libsvn_fetch_full() path.\n\n git-svn.perl |   46 +++++++++++++++++++++++++++++++++++++++-------\n 1 files changed, 39 insertions(+), 7 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 747daf0..c907eb9 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -72,7 +72,7 @@ my ($_revision,$_stdin,$_no_ignore_ext,$_no_stop_copy,$_help,$_rmdir,$_edit,\n \t$_username, $_config_dir, $_no_auth_cache, $_xfer_delta,\n \t$_pager, $_color);\n my (@_branch_from, %tree_map, %users, %rusers, %equiv);\n-my ($_svn_co_url_revs, $_svn_pg_peg_revs);\n+my ($_svn_co_url_revs, $_svn_pg_peg_revs, $_svn_can_do_switch);\n my @repo_path_split_cache;\n \n my %fc_opts = ( 'no-ignore-externals' => \\$_no_ignore_ext,\n@@ -2877,6 +2877,24 @@ sub libsvn_connect {\n \treturn $ra;\n }\n \n+sub libsvn_can_do_switch {\n+\tunless (defined $_svn_can_do_switch) {\n+\t\tmy $pool = SVN::Pool->new;\n+\t\tmy $rep = eval {\n+\t\t\t$SVN->do_switch(1, '', 0, $SVN->{url},\n+\t\t\t                SVN::Delta::Editor->new, $pool);\n+\t\t};\n+\t\tif ($@) {\n+\t\t\t$_svn_can_do_switch = 0;\n+\t\t} else {\n+\t\t\t$rep->abort_report($pool);\n+\t\t\t$_svn_can_do_switch = 1;\n+\t\t}\n+\t\t$pool->clear;\n+\t}\n+\t$_svn_can_do_switch;\n+}\n+\n sub libsvn_dup_ra {\n \tmy ($ra) = @_;\n \tSVN::Ra->new(map { $_ => $ra->{$_} } qw/config url\n@@ -3198,12 +3216,26 @@ sub libsvn_find_parent_branch {\n \t\tunlink $GIT_SVN_INDEX;\n \t\tprint STDERR \"Found branch parent: ($GIT_SVN) $parent\\n\";\n \t\tsys(qw/git-read-tree/, $parent);\n-\t\t# I can't seem to get do_switch() to work correctly with\n-\t\t# the SWIG interface (TypeError when passing switch_url...),\n-\t\t# so we'll unconditionally bypass the delta interface here\n-\t\t# for now\n-\t\treturn libsvn_fetch_full($parent, $paths, $rev,\n-\t\t\t\t\t$author, $date, $msg);\n+\t\tunless (libsvn_can_do_switch()) {\n+\t\t\treturn libsvn_fetch_full($parent, $paths, $rev,\n+\t\t\t\t\t\t$author, $date, $msg);\n+\t\t}\n+\t\t# do_switch works with svn/trunk >= r22312, but that is not\n+\t\t# included with SVN 1.4.2 (the latest version at the moment),\n+\t\t# so we can't rely on it.\n+\t\tmy $ra = libsvn_connect(\"$url/$branch_from\");\n+\t\tmy $ed = SVN::Git::Fetcher->new({c => $parent, q => $_q});\n+\t\tmy $pool = SVN::Pool->new;\n+\t\tmy $reporter = $ra->do_switch($rev, '', 1, $SVN->{url},\n+\t\t                              $ed, $pool);\n+\t\tmy @lock = $SVN::Core::VERSION ge '1.2.0' ? (undef) : ();\n+\t\t$reporter->set_path('', $r0, 0, @lock, $pool);\n+\t\t$reporter->finish_report($pool);\n+\t\t$pool->clear;\n+\t\tunless ($ed->{git_commit_ok}) {\n+\t\t\tdie \"SVN connection failed somewhere...\\n\";\n+\t\t}\n+\t\treturn libsvn_log_entry($rev, $author, $date, $msg, [$parent]);\n \t}\n \tprint STDERR \"Nope, branch point not imported or unknown\\n\";\n \treturn undef;\n-- \n"}]}