{"thread":{"id":"31197","subject":"Re: [PATCH v2 1/2] git-svn.perl: consider all ranges for a given merge, instead of only tip-by-tip","startedAt":"2012-08-07T00:47:41Z","lastAt":"2012-08-07T00:48:35Z","messageCount":2,"participants":["Eric Wong"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"196580","messageId":"20120807004741.GA25929@dcvr.yhbt.net","threadId":"31197","inReplyTo":"1344257176-17116-1-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH v2 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-07T00:47:41Z","receivedAt":"2012-08-07T00:47:41Z","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\nThanks Steven, Cc-ing Sam for mergeinfo stuff.\n\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..73cdda5\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 add foo &&\n\nsvn_cmd here, too\n\n> +\t\tsvn commit -m \"initial commit\" &&\n> +\t\tsvn cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n> +\t\tsvn switch \"$svnrepo\"/branches/branch1 &&\n> +\t\ttouch bar &&\n> +\t\tsvn add bar &&\n> +\t\tsvn commit -m branch1 &&\n> +\t\tsvn cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn switch \"$svnrepo\"/branches/branch2 &&\n> +\t\ttouch baz &&\n> +\t\tsvn add baz &&\n> +\t\tsvn commit -m branch2 &&\n> +\t\tsvn switch \"$svnrepo\"/trunk &&\n> +\t\ttouch bar2 &&\n> +\t\tsvn add bar2 &&\n> +\t\tsvn commit -m trunk &&\n> +\t\tsvn switch \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn merge \"$svnrepo\"/trunk &&\n> +\t\tsvn commit -m \"merge trunk\"\n> +\t\tsvn switch \"$svnrepo\"/trunk &&\n> +\t\tsvn merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn 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":"196581","messageId":"20120807004835.GB25929@dcvr.yhbt.net","threadId":"31197","inReplyTo":"1344257176-17116-2-git-send-email-stevenrwalter@gmail.com","subject":"Re: [PATCH v2 2/2] git-svn.perl: keep processing all commits in parents_exclude","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-08-07T00:48:35Z","receivedAt":"2012-08-07T00:48:35Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Steven Walter <stevenrwalter@gmail.com> 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\nSam: your eyes would be much appreciated for this series, thanks :)\n\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>  \t\t\t\telse {\n>  \t\t\t\t\tpush @new, $commit;\n> diff --git a/t/t9164-git-svn-fetch-merge-branch-of-branch2.sh b/t/t9164-git-svn-fetch-merge-branch-of-branch2.sh\n> new file mode 100755\n> index 0000000..3493de1\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 add foo &&\n\nsvn_cmd here, too\n\n> +\t\tsvn commit -m \"initial commit\" &&\n> +\t\tsvn cp -m branch \"$svnrepo\"/trunk \"$svnrepo\"/branches/branch1 &&\n> +\t\tsvn switch \"$svnrepo\"/branches/branch1 &&\n> +\t\ttouch bar &&\n> +\t\tsvn add bar &&\n> +\t\tsvn commit -m branch1 &&\n> +\t\tsvn cp -m branch \"$svnrepo\"/branches/branch1 \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn switch \"$svnrepo\"/branches/branch2 &&\n> +\t\ttouch baz &&\n> +\t\tsvn add baz &&\n> +\t\tsvn commit -m branch2 &&\n> +\t\tsvn switch \"$svnrepo\"/trunk &&\n> +\t\tsvn merge --reintegrate \"$svnrepo\"/branches/branch2 &&\n> +\t\tsvn 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"}]}