{"thread":{"id":"31332","subject":"[PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties","startedAt":"2012-08-23T16:07:15Z","lastAt":"2012-09-14T21:50:55Z","messageCount":2,"participants":["Avishay Lavie","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"197716","messageId":"CAHkK2bpCjmxTKmBj6Wqgmky2YjRk8_MQF6th8xxc6XoStdVOeg@mail.gmail.com","threadId":"31332","inReplyTo":null,"subject":"[PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties","fromName":"Avishay Lavie","fromEmail":"avishay.lavie@gmail.com","sentAt":"2012-08-23T16:07:15Z","receivedAt":"2012-08-23T16:07:15Z","isPatch":true,"sender":{"key":"avishay.lavie@gmail.com","avatar":"https://avatars.githubusercontent.com/u/557935?v=4"},"body":"Subject: [PATCH] git svn: Only follow first parents when populating\nsvn:mergeinfo\n properties.\n\nWhen svn.pushmergeinfo is set, git-svn tries to correctly populate mergeinfo\nproperties when encountering a merge commit. It does so by first aggregating\nthe mergeinfo property of the merged parent into the target, and then\nadding to it the SVN revision number of any commit reachable from the\nmerged parent but not from the first (target) parent.\n\nIf a third branch was merged into the merged parent (e.g. X was merged into Y\nand Y was then merged into Z), its revisions will be listed twice --\nonce as part\nof aggregating Y's mergeinfo property into Z's, and once more when walking\nthe tree and finding X's commits reachable from Y's tip. While the first listing\ncorrectly lists those revisions as merged from X, the second listing\nwill list them\nas merged from Y, creating incorrect mergeinfo properties that later cause\nunnecessary lookups and warnings when git-svn-fetching.\n\nAdding '--first-parent' to the rev-list command fixes this by only walking the\npart of the tree that's directly included in the merged branch (Y) and not any\nbranches merged into it (X).\n\nSigned-off-by: Avishay Lavie <avishay.lavie@gmail.com>\n---\n git-svn.perl |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 828b8f0..f69a4d6 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -728,7 +728,7 @@ sub populate_merge_info {\n\n  next if $parent eq $parents[0]; # Skip first parent\n  # Add new changes being placed in tree by merge\n- my @cmd = (qw/rev-list --reverse/,\n+ my @cmd = (qw/rev-list --first-parent --reverse/,\n    $parent, qw/--not/);\n  foreach my $par (@parents) {\n  unless ($par eq $parent) {\n-- \n1.7.10.msysgit.1\n"},{"id":"199078","messageId":"20120914215055.GB16293@dcvr.yhbt.net","threadId":"31332","inReplyTo":"CAHkK2bpCjmxTKmBj6Wqgmky2YjRk8_MQF6th8xxc6XoStdVOeg@mail.gmail.com","subject":"Re: [PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2012-09-14T21:50:55Z","receivedAt":"2012-09-14T21:50:55Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"I'm awaiting Sam's comment on this patch.\n\nAvishay Lavie <avishay.lavie@gmail.com> wrote:\n> Subject: [PATCH] git svn: Only follow first parents when populating\n> svn:mergeinfo\n>  properties.\n> \n> When svn.pushmergeinfo is set, git-svn tries to correctly populate mergeinfo\n> properties when encountering a merge commit. It does so by first aggregating\n> the mergeinfo property of the merged parent into the target, and then\n> adding to it the SVN revision number of any commit reachable from the\n> merged parent but not from the first (target) parent.\n> \n> If a third branch was merged into the merged parent (e.g. X was merged into Y\n> and Y was then merged into Z), its revisions will be listed twice --\n> once as part\n> of aggregating Y's mergeinfo property into Z's, and once more when walking\n> the tree and finding X's commits reachable from Y's tip. While the first listing\n> correctly lists those revisions as merged from X, the second listing\n> will list them\n> as merged from Y, creating incorrect mergeinfo properties that later cause\n> unnecessary lookups and warnings when git-svn-fetching.\n> \n> Adding '--first-parent' to the rev-list command fixes this by only walking the\n> part of the tree that's directly included in the merged branch (Y) and not any\n> branches merged into it (X).\n> \n> Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com>\n> ---\n>  git-svn.perl |    2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/git-svn.perl b/git-svn.perl\n> index 828b8f0..f69a4d6 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -728,7 +728,7 @@ sub populate_merge_info {\n> \n>   next if $parent eq $parents[0]; # Skip first parent\n>   # Add new changes being placed in tree by merge\n> - my @cmd = (qw/rev-list --reverse/,\n> + my @cmd = (qw/rev-list --first-parent --reverse/,\n>     $parent, qw/--not/);\n>   foreach my $par (@parents) {\n>   unless ($par eq $parent) {\n> -- \n\nYour patch seems badly whitespace mangled.  Fortunately it's a small\nchange and I can fix it by hand.\n"}]}