{"thread":{"id":"16549","subject":"[PATCH] git-svn: Make branch use correct svn-remote","startedAt":"2008-12-02T02:43:00Z","lastAt":"2008-12-04T19:26:45Z","messageCount":8,"participants":["Deskin Miller","Eric Wong","Junio C Hamano","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"96919","messageId":"1228185780-22938-1-git-send-email-deskinm@umich.edu","threadId":"16549","inReplyTo":null,"subject":"[PATCH] git-svn: Make branch use correct svn-remote","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2008-12-02T02:43:00Z","receivedAt":"2008-12-02T02:43:00Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"The 'branch' subcommand incorrectly had the svn-remote to use hardcoded\nas 'svn', the default remote name.  This meant that branches derived\nfrom other svn-remotes would try to use the branch and tag configuration\nfor the 'svn' remote, potentially copying would-be branches to the wrong\nplace in SVN, into the branch namespace for another project.\n\nFix this by using the remote name extracted from the svn info for the\nspecified git ref.  Add a testcase for this behaviour.\n\nSigned-off-by: Deskin Miller <deskinm@umich.edu>\n---\nApplies on v1.6.1-rc1.  Apologies for not catching this when first\nwriting testcases for the branch subcommand.\n\nDeskin Miller\n\n git-svn.perl                  |    2 +-\n t/t9128-git-svn-cmd-branch.sh |   17 +++++++++++++++++\n 2 files changed, 18 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 914c707..e64e97b 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -558,7 +558,7 @@ sub cmd_branch {\n \n \tmy ($src, $rev, undef, $gs) = working_head_info($head);\n \n-\tmy $remote = Git::SVN::read_all_remotes()->{svn};\n+\tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n \tmy $glob = $remote->{ $_tag ? 'tags' : 'branches' };\n \tmy ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};\n \tmy $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());\ndiff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh\nindex 47c4d4d..e2b6696 100755\n--- a/t/t9128-git-svn-cmd-branch.sh\n+++ b/t/t9128-git-svn-cmd-branch.sh\n@@ -56,4 +56,21 @@ test_expect_success 'git svn branch tests' '\n \ttest_must_fail git svn tag tag1\n '\n \n+test_expect_success 'branch uses correct svn-remote' '\n+\t(svn co \"$svnrepo\" svn &&\n+\tcd svn &&\n+\tmkdir mirror &&\n+\tsvn add mirror &&\n+\tsvn copy trunk tags branches mirror/ &&\n+\tsvn ci -m \"made mirror\" ) &&\n+\trm -rf svn &&\n+\tgit svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n+\tgit svn fetch -R mirror &&\n+\tgit checkout mirror/trunk &&\n+\tbase=$(git rev-parse HEAD:) &&\n+\tgit svn branch -m \"branch in mirror\" d &&\n+\ttest $base = $(git rev-parse remotes/mirror/d:) &&\n+\ttest_must_fail git rev-parse remotes/d\n+'\n+\n test_done\n-- \n1.6.1.rc1\n"},{"id":"96988","messageId":"20081202215157.GB9650@hand.yhbt.net","threadId":"16549","inReplyTo":"1228185780-22938-1-git-send-email-deskinm@umich.edu","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-12-02T21:51:57Z","receivedAt":"2008-12-02T21:51:57Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Deskin Miller <deskinm@umich.edu> wrote:\n> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded\n> as 'svn', the default remote name.  This meant that branches derived\n> from other svn-remotes would try to use the branch and tag configuration\n> for the 'svn' remote, potentially copying would-be branches to the wrong\n> place in SVN, into the branch namespace for another project.\n> \n> Fix this by using the remote name extracted from the svn info for the\n> specified git ref.  Add a testcase for this behaviour.\n> \n> Signed-off-by: Deskin Miller <deskinm@umich.edu>\n\nLooks alright to me, thanks Deskin.\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n> ---\n> Applies on v1.6.1-rc1.  Apologies for not catching this when first\n> writing testcases for the branch subcommand.\n> \n> Deskin Miller\n> \n>  git-svn.perl                  |    2 +-\n>  t/t9128-git-svn-cmd-branch.sh |   17 +++++++++++++++++\n>  2 files changed, 18 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 914c707..e64e97b 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -558,7 +558,7 @@ sub cmd_branch {\n>  \n>  \tmy ($src, $rev, undef, $gs) = working_head_info($head);\n>  \n> -\tmy $remote = Git::SVN::read_all_remotes()->{svn};\n> +\tmy $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};\n>  \tmy $glob = $remote->{ $_tag ? 'tags' : 'branches' };\n>  \tmy ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};\n>  \tmy $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());\n> diff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh\n> index 47c4d4d..e2b6696 100755\n> --- a/t/t9128-git-svn-cmd-branch.sh\n> +++ b/t/t9128-git-svn-cmd-branch.sh\n> @@ -56,4 +56,21 @@ test_expect_success 'git svn branch tests' '\n>  \ttest_must_fail git svn tag tag1\n>  '\n>  \n> +test_expect_success 'branch uses correct svn-remote' '\n> +\t(svn co \"$svnrepo\" svn &&\n> +\tcd svn &&\n> +\tmkdir mirror &&\n> +\tsvn add mirror &&\n> +\tsvn copy trunk tags branches mirror/ &&\n> +\tsvn ci -m \"made mirror\" ) &&\n> +\trm -rf svn &&\n> +\tgit svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n> +\tgit svn fetch -R mirror &&\n> +\tgit checkout mirror/trunk &&\n> +\tbase=$(git rev-parse HEAD:) &&\n> +\tgit svn branch -m \"branch in mirror\" d &&\n> +\ttest $base = $(git rev-parse remotes/mirror/d:) &&\n> +\ttest_must_fail git rev-parse remotes/d\n> +'\n> +\n>  test_done\n> -- \n> 1.6.1.rc1\n"},{"id":"97015","messageId":"7vbpvtj4kl.fsf@gitster.siamese.dyndns.org","threadId":"16549","inReplyTo":"20081202215157.GB9650@hand.yhbt.net","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-03T03:55:06Z","receivedAt":"2008-12-03T03:55:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> Deskin Miller <deskinm@umich.edu> wrote:\n>> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded\n>> as 'svn', the default remote name.  This meant that branches derived\n>> from other svn-remotes would try to use the branch and tag configuration\n>> for the 'svn' remote, potentially copying would-be branches to the wrong\n>> place in SVN, into the branch namespace for another project.\n>> \n>> Fix this by using the remote name extracted from the svn info for the\n>> specified git ref.  Add a testcase for this behaviour.\n>> \n>> Signed-off-by: Deskin Miller <deskinm@umich.edu>\n>\n> Looks alright to me, thanks Deskin.\n>\n> Acked-by: Eric Wong <normalperson@yhbt.net>\n\nDoes not work for me X-<.\n\n* expecting success:\n        (svn co \"$svnrepo\" svn &&\n        cd svn &&\n        mkdir mirror &&\n        svn add mirror &&\n        svn copy trunk tags branches mirror/ &&\n        svn ci -m \"made mirror\" ) &&\n        rm -rf svn &&\n        git svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n        git svn fetch -R mirror &&\n        git checkout mirror/trunk &&\n        base=$(git rev-parse HEAD:) &&\n        git svn branch -m \"branch in mirror\" d &&\n        test $base = $(git rev-parse remotes/mirror/d:) &&\n        test_must_fail git rev-parse remotes/d\n\nA    svn/trunk\nA    svn/trunk/foo\nA    svn/branches\nA    svn/branches/a\nA    svn/branches/a/foo\nA    svn/branches/b\nA    svn/branches/b/foo\nA    svn/tags\nA    svn/tags/tag4\nA    svn/tags/tag4/foo\nA    svn/tags/tag1\nA    svn/tags/tag1/foo\nA    svn/tags/tag2\nA    svn/tags/tag2/foo\nA    svn/tags/tag3\nA    svn/tags/tag3/foo\nChecked out revision 8.\nA         mirror\nsvn: Client error in parsing arguments\n* FAIL 4: branch uses correct svn-remote\n\n                (svn co \"$svnrepo\" svn &&\n                cd svn &&\n                mkdir mirror &&\n                svn add mirror &&\n                svn copy trunk tags branches mirror/ &&\n                svn ci -m \"made mirror\" ) &&\n                rm -rf svn &&\n                git svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n                git svn fetch -R mirror &&\n                git checkout mirror/trunk &&\n                base=$(git rev-parse HEAD:) &&\n                git svn branch -m \"branch in mirror\" d &&\n                test $base = $(git rev-parse remotes/mirror/d:) &&\n                test_must_fail git rev-parse remotes/d\n"},{"id":"97040","messageId":"1228296617-25473-1-git-send-email-git@drmicha.warpmail.net","threadId":"16549","inReplyTo":"7vbpvtj4kl.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] Make t9128-git-svn-cmd-branch pass with svn 1.4","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-12-03T09:30:17Z","receivedAt":"2008-12-03T09:30:17Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"The copy command in svn 1.4 allows only one source (svn copy A D), whereas\nthe copy command in svn 1.5 allows multiple sources (svn copy A B C D).\nThis patch rewrites t9128 to use the backwards compatible form.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\n t/t9128-git-svn-cmd-branch.sh |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh\nindex e2b6696..252daa7 100755\n--- a/t/t9128-git-svn-cmd-branch.sh\n+++ b/t/t9128-git-svn-cmd-branch.sh\n@@ -61,7 +61,9 @@ test_expect_success 'branch uses correct svn-remote' '\n \tcd svn &&\n \tmkdir mirror &&\n \tsvn add mirror &&\n-\tsvn copy trunk tags branches mirror/ &&\n+\tsvn copy trunk mirror/ &&\n+\tsvn copy tags mirror/ &&\n+\tsvn copy branches mirror/ &&\n \tsvn ci -m \"made mirror\" ) &&\n \trm -rf svn &&\n \tgit svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n-- \n1.6.1.rc1\n"},{"id":"97041","messageId":"49365259.5090803@drmicha.warpmail.net","threadId":"16549","inReplyTo":"7vbpvtj4kl.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2008-12-03T09:33:13Z","receivedAt":"2008-12-03T09:33:13Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 03.12.2008 04:55:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n>> Deskin Miller <deskinm@umich.edu> wrote:\n>>> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded\n>>> as 'svn', the default remote name.  This meant that branches derived\n>>> from other svn-remotes would try to use the branch and tag configuration\n>>> for the 'svn' remote, potentially copying would-be branches to the wrong\n>>> place in SVN, into the branch namespace for another project.\n>>>\n>>> Fix this by using the remote name extracted from the svn info for the\n>>> specified git ref.  Add a testcase for this behaviour.\n>>>\n>>> Signed-off-by: Deskin Miller <deskinm@umich.edu>\n>> Looks alright to me, thanks Deskin.\n>>\n>> Acked-by: Eric Wong <normalperson@yhbt.net>\n> \n> Does not work for me X-<.\n> \n> * expecting success:\n>         (svn co \"$svnrepo\" svn &&\n>         cd svn &&\n>         mkdir mirror &&\n>         svn add mirror &&\n>         svn copy trunk tags branches mirror/ &&\n>         svn ci -m \"made mirror\" ) &&\n>         rm -rf svn &&\n>         git svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n>         git svn fetch -R mirror &&\n>         git checkout mirror/trunk &&\n>         base=$(git rev-parse HEAD:) &&\n>         git svn branch -m \"branch in mirror\" d &&\n>         test $base = $(git rev-parse remotes/mirror/d:) &&\n>         test_must_fail git rev-parse remotes/d\n> \n> A    svn/trunk\n> A    svn/trunk/foo\n> A    svn/branches\n> A    svn/branches/a\n> A    svn/branches/a/foo\n> A    svn/branches/b\n> A    svn/branches/b/foo\n> A    svn/tags\n> A    svn/tags/tag4\n> A    svn/tags/tag4/foo\n> A    svn/tags/tag1\n> A    svn/tags/tag1/foo\n> A    svn/tags/tag2\n> A    svn/tags/tag2/foo\n> A    svn/tags/tag3\n> A    svn/tags/tag3/foo\n> Checked out revision 8.\n> A         mirror\n> svn: Client error in parsing arguments\n> * FAIL 4: branch uses correct svn-remote\n> \n>                 (svn co \"$svnrepo\" svn &&\n>                 cd svn &&\n>                 mkdir mirror &&\n>                 svn add mirror &&\n>                 svn copy trunk tags branches mirror/ &&\n\nWith my svn (1.4.6) it fails already here: \"svn copy\" allows two\narguments only. That may be different in svn 1.5.\n\n>                 svn ci -m \"made mirror\" ) &&\n>                 rm -rf svn &&\n>                 git svn init -s -R mirror --prefix=mirror/ \"$svnrepo\"/mirror &&\n>                 git svn fetch -R mirror &&\n>                 git checkout mirror/trunk &&\n>                 base=$(git rev-parse HEAD:) &&\n>                 git svn branch -m \"branch in mirror\" d &&\n>                 test $base = $(git rev-parse remotes/mirror/d:) &&\n>                 test_must_fail git rev-parse remotes/d\n\nIf I split the above copy into three lines then the test passes (svn\n1.4.6, Deskin's patch applied onto 1.6.1-rc1 with the fix.\n\nPatch coming. (Sorry I always forget the ccs with send-email.)\n\nMichael\n"},{"id":"97089","messageId":"7v1vwpdnwy.fsf@gitster.siamese.dyndns.org","threadId":"16549","inReplyTo":"49365259.5090803@drmicha.warpmail.net","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-12-03T20:06:05Z","receivedAt":"2008-12-03T20:06:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Patch coming. (Sorry I always forget the ccs with send-email.)\n\nThanks, indeed my environment has svn 1.4.2 installed and Deskin's patch\nwith your patch squashed in makes everything happy again.\n"},{"id":"97092","messageId":"20081203204246.GA28841@euler","threadId":"16549","inReplyTo":"7v1vwpdnwy.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Deskin Miller","fromEmail":"deskinm@umich.edu","sentAt":"2008-12-03T20:42:46Z","receivedAt":"2008-12-03T20:42:46Z","isPatch":true,"sender":{"key":"deskinm@umich.edu","avatar":"https://gravatar.com/avatar/d340a0e612cdf0a79535c71863c0b4c535e9aba63b42032226ae903e638b64f9?d=mp&s=160"},"body":"On Wed, Dec 03, 2008 at 12:06:05PM -0800, Junio C Hamano wrote:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n> > Patch coming. (Sorry I always forget the ccs with send-email.)\n> \n> Thanks, indeed my environment has svn 1.4.2 installed and Deskin's patch\n> with your patch squashed in makes everything happy again.\n\nAh, curse my trusting svn to work the same between versions, and not\ntesting on 1.4.  Thanks for the quick fix, Michael.\n\nDeskin Miller\n"},{"id":"97162","messageId":"20081204192645.GD9650@hand.yhbt.net","threadId":"16549","inReplyTo":"49365259.5090803@drmicha.warpmail.net","subject":"Re: [PATCH] git-svn: Make branch use correct svn-remote","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-12-04T19:26:45Z","receivedAt":"2008-12-04T19:26:45Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Michael J Gruber <git@drmicha.warpmail.net> wrote:\n> Junio C Hamano venit, vidit, dixit 03.12.2008 04:55:\n> > Eric Wong <normalperson@yhbt.net> writes:\n> >> Deskin Miller <deskinm@umich.edu> wrote:\n> \n> If I split the above copy into three lines then the test passes (svn\n> 1.4.6, Deskin's patch applied onto 1.6.1-rc1 with the fix.\n\nThank you all for the testing and fixes.\n\n-- \nEric Wong\n"}]}