{"thread":{"id":"33336","subject":"[PATCH] git-svn: avoid self-referencing mergeinfo","startedAt":"2013-03-30T22:06:42Z","lastAt":"2013-04-04T01:31:31Z","messageCount":2,"participants":["Michael Contreras","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"212710","messageId":"20130330220642.GA14641@gmail.com","threadId":"33336","inReplyTo":null,"subject":"[PATCH] git-svn: avoid self-referencing mergeinfo","fromName":"Michael Contreras","fromEmail":"michael@inetric.com","sentAt":"2013-03-30T22:06:42Z","receivedAt":"2013-03-30T22:06:42Z","isPatch":true,"sender":{"key":"michael@inetric.com","avatar":null},"body":"When svn.pushmergeinfo is set, the target branch is included in the\nmergeinfo if it was previously merged into one of the source branches.\nSVN does not do this.\n\nRemove merge target branch path from resulting mergeinfo when\nsvn.pushmergeinfo is set to better match the behavior of SVN. Update the\nsvn-mergeinfo-push test.\n\nSigned-off-by: Michael Contreras <michael@inetric.com>\nReported-by: Avishay Lavie <avishay.lavie@gmail.com>\n---\n\nAvishay's original patch was never applied.\nhttp://thread.gmane.org/gmane.comp.version-control.git/193123\n\n git-svn.perl                      | 9 ++++++---\n t/t9161-git-svn-mergeinfo-push.sh | 1 -\n 2 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex b46795f..bd4388d 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -669,12 +669,14 @@ sub merge_revs_into_hash {\n }\n \n sub merge_merge_info {\n-\tmy ($mergeinfo_one, $mergeinfo_two) = @_;\n+\tmy ($mergeinfo_one, $mergeinfo_two, $ignore_branch) = @_;\n \tmy %result_hash = ();\n \n \tmerge_revs_into_hash(\\%result_hash, $mergeinfo_one);\n \tmerge_revs_into_hash(\\%result_hash, $mergeinfo_two);\n \n+\tdelete $result_hash{$ignore_branch} if $ignore_branch;\n+\n \tmy $result = '';\n \t# Sort below is for consistency's sake\n \tfor my $branchname (sort keys(%result_hash)) {\n@@ -695,6 +697,7 @@ sub populate_merge_info {\n \t\tmy $all_parents_ok = 1;\n \t\tmy $aggregate_mergeinfo = '';\n \t\tmy $rooturl = $gs->repos_root;\n+\t\tmy ($target_branch) = $gs->full_pushurl =~ /^\\Q$rooturl\\E(.*)/;\n \n \t\tif (defined($rewritten_parent)) {\n \t\t\t# Replace first parent with newly-rewritten version\n@@ -726,7 +729,7 @@ sub populate_merge_info {\n \t\t\t# Merge previous mergeinfo values\n \t\t\t$aggregate_mergeinfo =\n \t\t\t\tmerge_merge_info($aggregate_mergeinfo,\n-\t\t\t\t\t\t\t\t $par_mergeinfo, 0);\n+\t\t\t\t\t\t\t\t $par_mergeinfo, $target_branch);\n \n \t\t\tnext if $parent eq $parents[0]; # Skip first parent\n \t\t\t# Add new changes being placed in tree by merge\n@@ -769,7 +772,7 @@ sub populate_merge_info {\n \t\t\tmy $newmergeinfo = \"$branchpath:\" . join(',', @revsin);\n \t\t\t$aggregate_mergeinfo =\n \t\t\t\tmerge_merge_info($aggregate_mergeinfo,\n-\t\t\t\t\t\t\t\t $newmergeinfo, 1);\n+\t\t\t\t\t\t\t\t $newmergeinfo, $target_branch);\n \t\t}\n \t\tif ($all_parents_ok and $aggregate_mergeinfo) {\n \t\t\treturn $aggregate_mergeinfo;\ndiff --git a/t/t9161-git-svn-mergeinfo-push.sh b/t/t9161-git-svn-mergeinfo-push.sh\nindex 6ef0c0b..1eab701 100755\n--- a/t/t9161-git-svn-mergeinfo-push.sh\n+++ b/t/t9161-git-svn-mergeinfo-push.sh\n@@ -88,7 +88,6 @@ test_expect_success 'check reintegration mergeinfo' '\n \ttest \"$mergeinfo\" = \"/branches/svnb1:2-4,7-9,13-18\n /branches/svnb2:3,8,16-17\n /branches/svnb3:4,9\n-/branches/svnb4:5-6,10-12\n /branches/svnb5:6,11\"\n \t'\n \n-- \n1.8.2\n"},{"id":"213081","messageId":"20130404013131.GA18539@dcvr.yhbt.net","threadId":"33336","inReplyTo":"20130330220642.GA14641@gmail.com","subject":"Re: [PATCH] git-svn: avoid self-referencing mergeinfo","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2013-04-04T01:31:31Z","receivedAt":"2013-04-04T01:31:31Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Michael Contreras <michael@inetric.com> wrote:\n> When svn.pushmergeinfo is set, the target branch is included in the\n> mergeinfo if it was previously merged into one of the source branches.\n> SVN does not do this.\n> \n> Remove merge target branch path from resulting mergeinfo when\n> svn.pushmergeinfo is set to better match the behavior of SVN. Update the\n> svn-mergeinfo-push test.\n> \n> Signed-off-by: Michael Contreras <michael@inetric.com>\n> Reported-by: Avishay Lavie <avishay.lavie@gmail.com>\n\nAcked-by: Eric Wong <normalperson@yhbt.net>\n\n80-column wrapped version pushed to git://bogomips.org/git-svn master\n(commit e5ee78e1f0835410a37bfa38e1ff5e1a82f8c7b5)\n\nWill ask Junio to pull unless Sam (our mergeinfo expert) gives a NACK\nsoon.\n"}]}