{"thread":{"id":"31236","subject":"[PATCH v3 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","startedAt":"2012-08-11T17:14:24Z","lastAt":"2012-08-21T22:38:35Z","messageCount":13,"participants":["Steven Walter","Eric Wong","Sam Vilain","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":2},"messages":[{"id":"196869","messageId":"1344705265-10939-1-git-send-email-stevenrwalter@gmail.com","threadId":"31236","inReplyTo":null,"subject":"[PATCH v3 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2012-08-11T17:14:24Z","receivedAt":"2012-08-11T17:14:24Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"Consider the case where you have trunk, branchA of trunk, and branchB of\nbranchA.  trunk is merged back into branchB, and then branchB is\nreintegrated into trunk.  The merge of branchB into trunk will have\nsvn:mergeinfo property references to both branchA and branchB.  When\nperforming the check_cherry_pick check on branchB, it is necessary to\neliminate the merged contents of branchA as well as branchB, or else the\nmerge will be incorrectly ignored as a cherry-pick.\n\nSigned-off-by: Steven Walter <stevenrwalter@gmail.com>\n---\n git-svn.perl                                    |    8 ++-\n t/t9163-git-svn-fetch-merge-branch-of-branch.sh |   60 +++++++++++++++++++++++\n 2 files changed, 63 insertions(+), 5 deletions(-)\n create mode 100755 t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex ca038ec..abcec11 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3657,14 +3657,14 @@ sub find_extra_svn_parents {\n \tmy @merge_tips;\n \tmy $url = $self->{url};\n \tmy $uuid = $self->ra_uuid;\n-\tmy %ranges;\n+\tmy @all_ranges;\n \tfor my $merge ( @merges ) {\n \t\tmy ($tip_commit, @ranges) =\n \t\t\tlookup_svn_merge( $uuid, $url, $merge );\n \t\tunless (!$tip_commit or\n \t\t\t\tgrep { $_ eq $tip_commit } @$parents ) {\n \t\t\tpush @merge_tips, $tip_commit;\n-\t\t\t$ranges{$tip_commit} = \\@ranges;\n+\t\t\tpush @all_ranges, @ranges;\n \t\t} else {\n \t\t\tpush @merge_tips, undef;\n \t\t}\n@@ -3679,8 +3679,6 @@ sub find_extra_svn_parents {\n \t\tmy $spec = shift @merges;\n \t\tnext unless $merge_tip and $excluded{$merge_tip};\n \n-\t\tmy $ranges = $ranges{$merge_tip};\n-\n \t\t# check out 'new' tips\n \t\tmy $merge_base;\n \t\teval {\n@@ -3702,7 +3700,7 @@ sub find_extra_svn_parents {\n \t\tmy (@incomplete) = check_cherry_pick(\n \t\t\t$merge_base, $merge_tip,\n \t\t\t$parents,\n-\t\t\t@$ranges,\n+\t\t\t@all_ranges,\n \t\t       );\n \n \t\tif ( @incomplete ) {\ndiff --git a/t/t9163-git-svn-fetch-merge-branch-of-branch.sh b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\nnew file mode 100755\nindex 0000000..13ae7e3\n--- /dev/null\n+++ b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n@@ -0,0 +1,60 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2012 Steven Walter\n+#\n+\n+test_description='git svn merge detection'\n+. ./lib-git-svn.sh\n+\n+svn_ver=\"$(svn --version --quiet)\"\n+case $svn_ver in\n+0.* | 1.[0-4].*)\n+\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success 'initialize source svn repo' '\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n+\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n+\t(\n+\t\tcd \"$SVN_TREE\" &&\n+\t\ttouch foo &&\n+\t\tsvn_cmd add foo &&\n+\t\tsvn_cmd commit -m \"initial commit\" &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n+\t\ttouch bar &&\n+\t\tsvn_cmd add bar &&\n+\t\tsvn_cmd commit -m branch1 &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\ttouch baz &&\n+\t\tsvn_cmd add baz &&\n+\t\tsvn_cmd commit -m branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\ttouch bar2 &&\n+\t\tsvn_cmd add bar2 &&\n+\t\tsvn_cmd commit -m trunk &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd merge \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd commit -m \"merge trunk\"\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd commit -m \"merge branch2\"\n+\t) &&\n+\trm -rf \"$SVN_TREE\"\n+'\n+\n+test_expect_success 'clone svn repo' '\n+\tgit svn init -s \"$svnrepo\" &&\n+\tgit svn fetch\n+'\n+\n+test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&\n+\ty=$(git rev-parse branch2) &&\n+\ttest \"x$x\" = \"x$y\"\n+'\n+\n+test_done\n-- \n1.7.9.5\n"},{"id":"196870","messageId":"1344705265-10939-2-git-send-email-stevenrwalter@gmail.com","threadId":"31236","inReplyTo":"1344705265-10939-1-git-send-email-stevenrwalter@gmail.com","subject":"[PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2012-08-11T17:14:25Z","receivedAt":"2012-08-11T17:14:25Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"This fixes a bug where git finds the incorrect merge parent.  Consider a\nrepository with trunk, branch1 of trunk, and branch2 of branch1.\nWithout this change, git interprets a merge of branch2 into trunk as a\nmerge of branch1 into trunk.\n\nSigned-off-by: Steven Walter <stevenrwalter@gmail.com>\n---\n git-svn.perl                                     |    1 -\n t/t9164-git-svn-fetch-merge-branch-of-branch2.sh |   53 ++++++++++++++++++++++\n 2 files changed, 53 insertions(+), 1 deletion(-)\n create mode 100755 t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex abcec11..c4678c1 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3623,7 +3623,6 @@ sub parents_exclude {\n \t\t\t\tif ( $commit eq $excluded ) {\n \t\t\t\t\tpush @excluded, $commit;\n \t\t\t\t\t$found++;\n-\t\t\t\t\tlast;\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\tpush @new, $commit;\ndiff --git a/t/t9164-git-svn-fetch-merge-branch-of-branch2.sh b/t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\nnew file mode 100755\nindex 0000000..af0ec0e\n--- /dev/null\n+++ b/t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\n@@ -0,0 +1,53 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2012 Steven Walter\n+#\n+\n+test_description='git svn merge detection'\n+. ./lib-git-svn.sh\n+\n+svn_ver=\"$(svn --version --quiet)\"\n+case $svn_ver in\n+0.* | 1.[0-4].*)\n+\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success 'initialize source svn repo' '\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n+\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n+\t(\n+\t\tcd \"$SVN_TREE\" &&\n+\t\ttouch foo &&\n+\t\tsvn_cmd add foo &&\n+\t\tsvn_cmd commit -m \"initial commit\" &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n+\t\ttouch bar &&\n+\t\tsvn_cmd add bar &&\n+\t\tsvn_cmd commit -m branch1 &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\ttouch baz &&\n+\t\tsvn_cmd add baz &&\n+\t\tsvn_cmd commit -m branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd commit -m \"merge branch2\"\n+\t) &&\n+\trm -rf \"$SVN_TREE\"\n+'\n+\n+test_expect_success 'clone svn repo' '\n+\tgit svn init -s \"$svnrepo\" &&\n+\tgit svn fetch\n+'\n+\n+test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&\n+\ty=$(git rev-parse branch2) &&\n+\ttest \"x$x\" = \"x$y\"\n+'\n+\n+test_done\n-- \n1.7.9.5\n"},{"id":"196901","messageId":"20120813070850.GA9190@dcvr.yhbt.net","threadId":"31236","inReplyTo":"1344705265-10939-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH v3 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-08-13T07:08:50Z","receivedAt":"2012-08-13T07:08:50Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> wrote:\n> Consider the case where you have trunk, branchA of trunk, and branchB of\n> branchA.  trunk is merged back into branchB, and then branchB is\n> reintegrated into trunk.  The merge of branchB into trunk will have\n> svn:mergeinfo property references to both branchA and branchB.  When\n> performing the check_cherry_pick check on branchB, it is necessary to\n> eliminate the merged contents of branchA as well as branchB, or else the\n> merge will be incorrectly ignored as a cherry-pick.\n> \n> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n> ---\n\nI think this series is good, but would feel more comfortable if\nI got a second opinion from Sam.\n\nThis doesn't apply against Junio's master (nor mine on\ngit://bogomips.org/git-svn.git), though it works fine on Junio's maint.\n\n>  git-svn.perl                                    |    8 ++-\n>  t/t9163-git-svn-fetch-merge-branch-of-branch.sh |   60 +++++++++++++++++++++++\n>  2 files changed, 63 insertions(+), 5 deletions(-)\n>  create mode 100755 t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index ca038ec..abcec11 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -3657,14 +3657,14 @@ sub find_extra_svn_parents {\n>  \tmy @merge_tips;\n>  \tmy $url = $self->{url};\n>  \tmy $uuid = $self->ra_uuid;\n> -\tmy %ranges;\n> +\tmy @all_ranges;\n>  \tfor my $merge ( @merges ) {\n>  \t\tmy ($tip_commit, @ranges) =\n>  \t\t\tlookup_svn_merge( $uuid, $url, $merge );\n>  \t\tunless (!$tip_commit or\n>  \t\t\t\tgrep { $_ eq $tip_commit } @$parents ) {\n>  \t\t\tpush @merge_tips, $tip_commit;\n> -\t\t\t$ranges{$tip_commit} = \\@ranges;\n> +\t\t\tpush @all_ranges, @ranges;\n>  \t\t} else {\n>  \t\t\tpush @merge_tips, undef;\n>  \t\t}\n> @@ -3679,8 +3679,6 @@ sub find_extra_svn_parents {\n>  \t\tmy $spec = shift @merges;\n>  \t\tnext unless $merge_tip and $excluded{$merge_tip};\n>  \n> -\t\tmy $ranges = $ranges{$merge_tip};\n> -\n>  \t\t# check out 'new' tips\n>  \t\tmy $merge_base;\n>  \t\teval {\n> @@ -3702,7 +3700,7 @@ sub find_extra_svn_parents {\n>  \t\tmy (@incomplete) = check_cherry_pick(\n>  \t\t\t$merge_base, $merge_tip,\n>  \t\t\t$parents,\n> -\t\t\t@$ranges,\n> +\t\t\t@all_ranges,\n>  \t\t       );\n>  \n>  \t\tif ( @incomplete ) {\n> diff --git a/t/t9163-git-svn-fetch-merge-branch-of-branch.sh b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n> new file mode 100755\n> index 0000000..13ae7e3\n> --- /dev/null\n> +++ b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n> @@ -0,0 +1,60 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2012 Steven Walter\n> +#\n> +\n> +test_description='git svn merge detection'\n> +. ./lib-git-svn.sh\n> +\n> +svn_ver=\"$(svn --version --quiet)\"\n> +case $svn_ver in\n> +0.* | 1.[0-4].*)\n> +\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n> +\ttest_done\n> +\t;;\n> +esac\n> +\n> +test_expect_success 'initialize source svn repo' '\n> +\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n> +\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n> +\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n> +\t(\n> +\t\tcd \"$SVN_TREE\" &&\n> +\t\ttouch foo &&\n> +\t\tsvn_cmd add foo &&\n> +\t\tsvn_cmd commit -m \"initial commit\" &&\n> +\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n> +\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n> +\t\ttouch bar &&\n> +\t\tsvn_cmd add bar &&\n> +\t\tsvn_cmd commit -m branch1 &&\n> +\t\tsvn_cmd cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n> +\t\ttouch baz &&\n> +\t\tsvn_cmd add baz &&\n> +\t\tsvn_cmd commit -m branch2 &&\n> +\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n> +\t\ttouch bar2 &&\n> +\t\tsvn_cmd add bar2 &&\n> +\t\tsvn_cmd commit -m trunk &&\n> +\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn_cmd merge \"$svnrepo\"/trunk &&\n> +\t\tsvn_cmd commit -m \"merge trunk\"\n> +\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n> +\t\tsvn_cmd merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn_cmd commit -m \"merge branch2\"\n> +\t) &&\n> +\trm -rf \"$SVN_TREE\"\n> +'\n> +\n> +test_expect_success 'clone svn repo' '\n> +\tgit svn init -s \"$svnrepo\" &&\n> +\tgit svn fetch\n> +'\n> +\n> +test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&\n> +\ty=$(git rev-parse branch2) &&\n> +\ttest \"x$x\" = \"x$y\"\n> +'\n> +\n> +test_done\n> -- \n> 1.7.9.5\n"},{"id":"197256","messageId":"502FF1BF.104@vilain.net","threadId":"31236","inReplyTo":"1344705265-10939-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH v3 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2012-08-18T19:49:19Z","receivedAt":"2012-08-18T19:49:19Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On 08/11/2012 10:14 AM, Steven Walter wrote:\n> Consider the case where you have trunk, branchA of trunk, and branchB of\n> branchA.  trunk is merged back into branchB, and then branchB is\n> reintegrated into trunk.  The merge of branchB into trunk will have\n> svn:mergeinfo property references to both branchA and branchB.\n\nNice start, and then...\n\n>    When\n> performing the check_cherry_pick check on branchB,\n\nYou switch from a user story to an implementation detail.  Perhaps you \ncould state the user action which is affected here and mention the \nimplementation details in parentheses.\n\n>   it is necessary to\n> eliminate the merged contents of branchA as well as branchB, or else the\n> merge will be incorrectly ignored as a cherry-pick.\n>\n> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n> ---\n>   git-svn.perl                                    |    8 ++-\n>   t/t9163-git-svn-fetch-merge-branch-of-branch.sh |   60 +++++++++++++++++++++++\n>   2 files changed, 63 insertions(+), 5 deletions(-)\n>   create mode 100755 t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n>\n> diff --git a/git-svn.perl b/git-svn.perl\n> index ca038ec..abcec11 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -3657,14 +3657,14 @@ sub find_extra_svn_parents {\n>   \tmy @merge_tips;\n>   \tmy $url = $self->{url};\n>   \tmy $uuid = $self->ra_uuid;\n> -\tmy %ranges;\n> +\tmy @all_ranges;\n>   \tfor my $merge ( @merges ) {\n>   \t\tmy ($tip_commit, @ranges) =\n>   \t\t\tlookup_svn_merge( $uuid, $url, $merge );\n>   \t\tunless (!$tip_commit or\n>   \t\t\t\tgrep { $_ eq $tip_commit } @$parents ) {\n>   \t\t\tpush @merge_tips, $tip_commit;\n> -\t\t\t$ranges{$tip_commit} = \\@ranges;\n> +\t\t\tpush @all_ranges, @ranges;\n>   \t\t} else {\n>   \t\t\tpush @merge_tips, undef;\n>   \t\t}\n> @@ -3679,8 +3679,6 @@ sub find_extra_svn_parents {\n>   \t\tmy $spec = shift @merges;\n>   \t\tnext unless $merge_tip and $excluded{$merge_tip};\n>   \n> -\t\tmy $ranges = $ranges{$merge_tip};\n> -\n>   \t\t# check out 'new' tips\n>   \t\tmy $merge_base;\n>   \t\teval {\n> @@ -3702,7 +3700,7 @@ sub find_extra_svn_parents {\n>   \t\tmy (@incomplete) = check_cherry_pick(\n>   \t\t\t$merge_base, $merge_tip,\n>   \t\t\t$parents,\n> -\t\t\t@$ranges,\n> +\t\t\t@all_ranges,\n>   \t\t       );\n\nThis all looks very plausibly correct.\n\n>   \t\tif ( @incomplete ) {\n> diff --git a/t/t9163-git-svn-fetch-merge-branch-of-branch.sh b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n> new file mode 100755\n> index 0000000..13ae7e3\n> --- /dev/null\n> +++ b/t/t9163-git-svn-fetch-merge-branch-of-branch.sh\n> @@ -0,0 +1,60 @@\n> +#!/bin/sh\n> +#\n> +# Copyright (c) 2012 Steven Walter\n> +#\n> +\n> +test_description='git svn merge detection'\n> +. ./lib-git-svn.sh\n> +\n> +svn_ver=\"$(svn --version --quiet)\"\n> +case $svn_ver in\n> +0.* | 1.[0-4].*)\n> +\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n> +\ttest_done\n> +\t;;\n> +esac\n> +\n> +test_expect_success 'initialize source svn repo' '\n> +\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n> +\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n> +\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n> +\t(\n> +\t\tcd \"$SVN_TREE\" &&\n> +\t\ttouch foo &&\n> +\t\tsvn_cmd add foo &&\n> +\t\tsvn_cmd commit -m \"initial commit\" &&\n> +\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n> +\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n\nYou refer to these as \"branchA\" and \"branchB\" in your commit message.  \nIt would be easier to follow if you were consistent.\n\nOtherwise, nice fix.  I'm glad that someone is finding the corner cases \nin this code!  :)\n\nSam\n"},{"id":"197255","messageId":"502FF250.6010402@vilain.net","threadId":"31236","inReplyTo":"1344705265-10939-2-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2012-08-18T19:51:44Z","receivedAt":"2012-08-18T19:51:44Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"On 08/11/2012 10:14 AM, Steven Walter wrote:\n> This fixes a bug where git finds the incorrect merge parent.  Consider a\n> repository with trunk, branch1 of trunk, and branch2 of branch1.\n> Without this change, git interprets a merge of branch2 into trunk as a\n> merge of branch1 into trunk.\n>\n> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n> ---\n>   git-svn.perl                                     |    1 -\n>   t/t9164-git-svn-fetch-merge-branch-of-branch2.sh |   53 ++++++++++++++++++++++\n>   2 files changed, 53 insertions(+), 1 deletion(-)\n>   create mode 100755 t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\n>\n> diff --git a/git-svn.perl b/git-svn.perl\n> index abcec11..c4678c1 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -3623,7 +3623,6 @@ sub parents_exclude {\n>   \t\t\t\tif ( $commit eq $excluded ) {\n>   \t\t\t\t\tpush @excluded, $commit;\n>   \t\t\t\t\t$found++;\n> -\t\t\t\t\tlast;\n>   \t\t\t\t}\n\nI could believe that, too.  I like this change: one line of code, 53 \nlines of test and a paragraph of explanation :-).\n\nCheers,\nSam.\n"},{"id":"197264","messageId":"CAK8d-aKMsSQGMmLrUFDCr1VDbxGPVsPJFgR=Okd-=7BV3AjzOQ@mail.gmail.com","threadId":"31236","inReplyTo":"502FF250.6010402@vilain.net","subject":"Re: [PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2012-08-18T20:43:45Z","receivedAt":"2012-08-18T20:43:45Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"On Sat, Aug 18, 2012 at 3:51 PM, Sam Vilain <sam@vilain.net> wrote:\n> On 08/11/2012 10:14 AM, Steven Walter wrote:\n>>\n>> This fixes a bug where git finds the incorrect merge parent.  Consider a\n>> repository with trunk, branch1 of trunk, and branch2 of branch1.\n>> Without this change, git interprets a merge of branch2 into trunk as a\n>> merge of branch1 into trunk.\n>>\n>> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n>> ---\n>>   git-svn.perl                                     |    1 -\n>>   t/t9164-git-svn-fetch-merge-branch-of-branch2.sh |   53\n>> ++++++++++++++++++++++\n>>   2 files changed, 53 insertions(+), 1 deletion(-)\n>>   create mode 100755 t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\n>>\n>> diff --git a/git-svn.perl b/git-svn.perl\n>> index abcec11..c4678c1 100755\n>> --- a/git-svn.perl\n>> +++ b/git-svn.perl\n>> @@ -3623,7 +3623,6 @@ sub parents_exclude {\n>>                                 if ( $commit eq $excluded ) {\n>>                                         push @excluded, $commit;\n>>                                         $found++;\n>> -                                       last;\n>>                                 }\n>\n>\n> I could believe that, too.  I like this change: one line of code, 53 lines\n> of test and a paragraph of explanation :-).\n\nHow about a Signed-Off-By?\n-- \n-Steven Walter <stevenrwalter@gmail.com>\n"},{"id":"197270","messageId":"50302736.9060404@vilain.net","threadId":"31236","inReplyTo":"CAK8d-aKMsSQGMmLrUFDCr1VDbxGPVsPJFgR=Okd-=7BV3AjzOQ@mail.gmail.com","subject":"Re: [PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2012-08-18T23:37:26Z","receivedAt":"2012-08-18T23:37:26Z","isPatch":true,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"-----BEGIN PGP SIGNED MESSAGE-----\nHash: SHA512\n\nOn 08/18/2012 01:43 PM, Steven Walter wrote:\n > How about a Signed-Off-By?\n\nSigned-Off-By: Sam Vilain <sam@vilain.net>\n\nSam\n\n-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v1.4.11 (GNU/Linux)\n\niQEcBAEBCgAGBQJQMCcnAAoJEBdtaL3wGtIoJ1UIAIJ6Xz5OEMmMk1tq546eggHg\nI+sJIFjqg+mo53VqT0/bKhqg8sLx8F/Gda15nwOUMcslKJdA+sCc+QhAtgSWJ1WK\nIdw59jtZHbabfopBHNgneSqVBhXSKpNw3e3EvlRVkK1wobO0+c0X6YkBG0eBCZl2\n6RYXIAb6jX04k1hSrnxcPn+REkoyl31aEuFBPNz0wRWHjju+G6bPY/x7D/gO1YOc\n/uRQXveQngJOLwawDR+dGS+0aWPseX/sbZqsVFo0hVQYqoHt+s4uVuriBfHSRKd+\nR1eUoY0ikW4UvEwZX74Zf3SeoVLLFnkCW8B5XsGb10IojbvY3uyYevATXI79j1Y=\n=Lb7H\n-----END PGP SIGNATURE-----\n"},{"id":"197272","messageId":"7vipcfrckn.fsf@alter.siamese.dyndns.org","threadId":"31236","inReplyTo":"50302736.9060404@vilain.net","subject":"Re: [PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-18T23:43:20Z","receivedAt":"2012-08-18T23:43:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sam Vilain <sam@vilain.net> writes:\n\n> On 08/18/2012 01:43 PM, Steven Walter wrote:\n>  > How about a Signed-Off-By?\n>\n> Signed-Off-By: Sam Vilain <sam@vilain.net>\n\nI think you meant reviewed-by or acked-by?\n"},{"id":"197298","messageId":"20120819193356.GA6203@dcvr.yhbt.net","threadId":"31236","inReplyTo":"CAK8d-aKMsSQGMmLrUFDCr1VDbxGPVsPJFgR=Okd-=7BV3AjzOQ@mail.gmail.com","subject":"Re: [PATCH v3 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-08-19T19:33:56Z","receivedAt":"2012-08-19T19:33:56Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> wrote:\n> On Sat, Aug 18, 2012 at 3:51 PM, Sam Vilain <sam@vilain.net> wrote:\n> > On 08/11/2012 10:14 AM, Steven Walter wrote:\n> >> ---\n> >>   git-svn.perl                                     |    1 -\n> >>   t/t9164-git-svn-fetch-merge-branch-of-branch2.sh |   53\n> >> ++++++++++++++++++++++\n\nThanks all.\n\nSteven: This doesn't apply cleanly to master since git-svn.perl is\nsplit into separate files (git-svn.perl -> perl/Git/SVN*)\n\nCan you rebase against Junio's current master?  Thanks again.\n"},{"id":"197315","messageId":"1345426781-7754-1-git-send-email-stevenrwalter@gmail.com","threadId":"31236","inReplyTo":"20120819193356.GA6203@dcvr.yhbt.net","subject":"[PATCH 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2012-08-20T01:39:40Z","receivedAt":"2012-08-20T01:39:40Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"Consider the case where you have trunk, branch1 of trunk, and branch2 of\nbranch1.  trunk is merged back into branch2, and then branch2 is\nreintegrated into trunk.  The merge of branch2 into trunk will have\nsvn:mergeinfo property references to both branch1 and branch2.  When\ngit-svn fetches the commit that merges branch2 (check_cherry_pick),\nit is necessary to eliminate the merged contents of branch1 as well as\nbranch2, or else the merge will be incorrectly ignored as a cherry-pick.\n\nSigned-off-by: Steven Walter <stevenrwalter@gmail.com>\n---\n perl/Git/SVN.pm                                 |    8 ++-\n t/t9165-git-svn-fetch-merge-branch-of-branch.sh |   60 +++++++++++++++++++++++\n 2 files changed, 63 insertions(+), 5 deletions(-)\n create mode 100755 t/t9165-git-svn-fetch-merge-branch-of-branch.sh\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 8478d0c..2707003 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1695,14 +1695,14 @@ sub find_extra_svn_parents {\n \tmy @merge_tips;\n \tmy $url = $self->{url};\n \tmy $uuid = $self->ra_uuid;\n-\tmy %ranges;\n+\tmy @all_ranges;\n \tfor my $merge ( @merges ) {\n \t\tmy ($tip_commit, @ranges) =\n \t\t\tlookup_svn_merge( $uuid, $url, $merge );\n \t\tunless (!$tip_commit or\n \t\t\t\tgrep { $_ eq $tip_commit } @$parents ) {\n \t\t\tpush @merge_tips, $tip_commit;\n-\t\t\t$ranges{$tip_commit} = \\@ranges;\n+\t\t\tpush @all_ranges, @ranges;\n \t\t} else {\n \t\t\tpush @merge_tips, undef;\n \t\t}\n@@ -1717,8 +1717,6 @@ sub find_extra_svn_parents {\n \t\tmy $spec = shift @merges;\n \t\tnext unless $merge_tip and $excluded{$merge_tip};\n \n-\t\tmy $ranges = $ranges{$merge_tip};\n-\n \t\t# check out 'new' tips\n \t\tmy $merge_base;\n \t\teval {\n@@ -1740,7 +1738,7 @@ sub find_extra_svn_parents {\n \t\tmy (@incomplete) = check_cherry_pick(\n \t\t\t$merge_base, $merge_tip,\n \t\t\t$parents,\n-\t\t\t@$ranges,\n+\t\t\t@all_ranges,\n \t\t       );\n \n \t\tif ( @incomplete ) {\ndiff --git a/t/t9165-git-svn-fetch-merge-branch-of-branch.sh b/t/t9165-git-svn-fetch-merge-branch-of-branch.sh\nnew file mode 100755\nindex 0000000..13ae7e3\n--- /dev/null\n+++ b/t/t9165-git-svn-fetch-merge-branch-of-branch.sh\n@@ -0,0 +1,60 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2012 Steven Walter\n+#\n+\n+test_description='git svn merge detection'\n+. ./lib-git-svn.sh\n+\n+svn_ver=\"$(svn --version --quiet)\"\n+case $svn_ver in\n+0.* | 1.[0-4].*)\n+\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success 'initialize source svn repo' '\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n+\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n+\t(\n+\t\tcd \"$SVN_TREE\" &&\n+\t\ttouch foo &&\n+\t\tsvn_cmd add foo &&\n+\t\tsvn_cmd commit -m \"initial commit\" &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n+\t\ttouch bar &&\n+\t\tsvn_cmd add bar &&\n+\t\tsvn_cmd commit -m branch1 &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\ttouch baz &&\n+\t\tsvn_cmd add baz &&\n+\t\tsvn_cmd commit -m branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\ttouch bar2 &&\n+\t\tsvn_cmd add bar2 &&\n+\t\tsvn_cmd commit -m trunk &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd merge \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd commit -m \"merge trunk\"\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd commit -m \"merge branch2\"\n+\t) &&\n+\trm -rf \"$SVN_TREE\"\n+'\n+\n+test_expect_success 'clone svn repo' '\n+\tgit svn init -s \"$svnrepo\" &&\n+\tgit svn fetch\n+'\n+\n+test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&\n+\ty=$(git rev-parse branch2) &&\n+\ttest \"x$x\" = \"x$y\"\n+'\n+\n+test_done\n-- \n1.7.9.5\n"},{"id":"197316","messageId":"1345426781-7754-2-git-send-email-stevenrwalter@gmail.com","threadId":"31236","inReplyTo":"1345426781-7754-1-git-send-email-stevenrwalter@gmail.com","subject":"[PATCH 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2012-08-20T01:39:41Z","receivedAt":"2012-08-20T01:39:41Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"This fixes a bug where git finds the incorrect merge parent.  Consider a\nrepository with trunk, branch1 of trunk, and branch2 of branch1.\nWithout this change, git interprets a merge of branch2 into trunk as a\nmerge of branch1 into trunk.\n\nSigned-off-by: Steven Walter <stevenrwalter@gmail.com>\n---\n perl/Git/SVN.pm                                  |    1 -\n t/t9166-git-svn-fetch-merge-branch-of-branch2.sh |   53 ++++++++++++++++++++++\n 2 files changed, 53 insertions(+), 1 deletion(-)\n create mode 100755 t/t9166-git-svn-fetch-merge-branch-of-branch2.sh\n\ndiff --git a/perl/Git/SVN.pm b/perl/Git/SVN.pm\nindex 2707003..e48ba46 100644\n--- a/perl/Git/SVN.pm\n+++ b/perl/Git/SVN.pm\n@@ -1661,7 +1661,6 @@ sub parents_exclude {\n \t\t\t\tif ( $commit eq $excluded ) {\n \t\t\t\t\tpush @excluded, $commit;\n \t\t\t\t\t$found++;\n-\t\t\t\t\tlast;\n \t\t\t\t}\n \t\t\t\telse {\n \t\t\t\t\tpush @new, $commit;\ndiff --git a/t/t9166-git-svn-fetch-merge-branch-of-branch2.sh b/t/t9166-git-svn-fetch-merge-branch-of-branch2.sh\nnew file mode 100755\nindex 0000000..af0ec0e\n--- /dev/null\n+++ b/t/t9166-git-svn-fetch-merge-branch-of-branch2.sh\n@@ -0,0 +1,53 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2012 Steven Walter\n+#\n+\n+test_description='git svn merge detection'\n+. ./lib-git-svn.sh\n+\n+svn_ver=\"$(svn --version --quiet)\"\n+case $svn_ver in\n+0.* | 1.[0-4].*)\n+\tskip_all=\"skipping git-svn test - SVN too old ($svn_ver)\"\n+\ttest_done\n+\t;;\n+esac\n+\n+test_expect_success 'initialize source svn repo' '\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n+\tsvn_cmd mkdir -m x \"$svnrepo\"/branches &&\n+\tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n+\t(\n+\t\tcd \"$SVN_TREE\" &&\n+\t\ttouch foo &&\n+\t\tsvn_cmd add foo &&\n+\t\tsvn_cmd commit -m \"initial commit\" &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch1 &&\n+\t\ttouch bar &&\n+\t\tsvn_cmd add bar &&\n+\t\tsvn_cmd commit -m branch1 &&\n+\t\tsvn_cmd cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/branches/branch2 &&\n+\t\ttouch baz &&\n+\t\tsvn_cmd add baz &&\n+\t\tsvn_cmd commit -m branch2 &&\n+\t\tsvn_cmd switch \"$svnrepo\"/trunk &&\n+\t\tsvn_cmd merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n+\t\tsvn_cmd commit -m \"merge branch2\"\n+\t) &&\n+\trm -rf \"$SVN_TREE\"\n+'\n+\n+test_expect_success 'clone svn repo' '\n+\tgit svn init -s \"$svnrepo\" &&\n+\tgit svn fetch\n+'\n+\n+test_expect_success 'verify merge commit' 'x=$(git rev-parse HEAD^2) &&\n+\ty=$(git rev-parse branch2) &&\n+\ttest \"x$x\" = \"x$y\"\n+'\n+\n+test_done\n-- \n1.7.9.5\n"},{"id":"197563","messageId":"20120821220556.GA5848@dcvr.yhbt.net","threadId":"31236","inReplyTo":"1345426781-7754-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-08-21T22:05:56Z","receivedAt":"2012-08-21T22:05:56Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> wrote:\n> Consider the case where you have trunk, branch1 of trunk, and branch2 of\n> branch1.  trunk is merged back into branch2, and then branch2 is\n> reintegrated into trunk.  The merge of branch2 into trunk will have\n> svn:mergeinfo property references to both branch1 and branch2.  When\n> git-svn fetches the commit that merges branch2 (check_cherry_pick),\n> it is necessary to eliminate the merged contents of branch1 as well as\n> branch2, or else the merge will be incorrectly ignored as a cherry-pick.\n> \n> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n\nThanks, I've Signed-off (also added Sam's Reviewed-by) and\npushed to \"for-git-master\" on git://bogomips.org/git-svn\n\n(Will wait on a few other patches before asking Junio to pull)\n"},{"id":"197567","messageId":"7vobm3c1lg.fsf@alter.siamese.dyndns.org","threadId":"31236","inReplyTo":"20120821220556.GA5848@dcvr.yhbt.net","subject":"Re: [PATCH 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-08-21T22:38:35Z","receivedAt":"2012-08-21T22:38:35Z","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> Steven Walter <stevenrwalter@gmail.com> wrote:\n>> Consider the case where you have trunk, branch1 of trunk, and branch2 of\n>> branch1.  trunk is merged back into branch2, and then branch2 is\n>> reintegrated into trunk.  The merge of branch2 into trunk will have\n>> svn:mergeinfo property references to both branch1 and branch2.  When\n>> git-svn fetches the commit that merges branch2 (check_cherry_pick),\n>> it is necessary to eliminate the merged contents of branch1 as well as\n>> branch2, or else the merge will be incorrectly ignored as a cherry-pick.\n>> \n>> Signed-off-by: Steven Walter <stevenrwalter@gmail.com>\n>\n> Thanks, I've Signed-off (also added Sam's Reviewed-by) and\n> pushed to \"for-git-master\" on git://bogomips.org/git-svn\n>\n> (Will wait on a few other patches before asking Junio to pull)\n\nIf there are stuff that should go to 1.7.12 maintenance track,\nplease separate them from new features and risky improvements.\n\nThanks.\n"}]}