threads / patch / 31332

patchgit svn: Only follow first parents when populating svn:mergeinfo properties

Subject: [PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties

## tl;dr

2 messages between Aug 23, 2012 and Sep 14, 2012. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Avishay Lavie· Aug 23, 2012, 16:07 UTC · lore
Subject: [PATCH] git svn: Only follow first parents when populating
svn:mergeinfo
 properties.

When svn.pushmergeinfo is set, git-svn tries to correctly populate mergeinfo properties when encountering a merge commit. It does so by first aggregating the mergeinfo property of the merged parent into the target, and then adding to it the SVN revision number of any commit reachable from the merged parent but not from the first (target) parent.

If a third branch was merged into the merged parent (e.g. X was merged into Y and Y was then merged into Z), its revisions will be listed twice -- once as part of aggregating Y's mergeinfo property into Z's, and once more when walking the tree and finding X's commits reachable from Y's tip. While the first listing correctly lists those revisions as merged from X, the second listing will list them as merged from Y, creating incorrect mergeinfo properties that later cause unnecessary lookups and warnings when git-svn-fetching.

Adding '--first-parent' to the rev-list command fixes this by only walking the part of the tree that's directly included in the merged branch (Y) and not any branches merged into it (X).

Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com>
---
 git-svn.perl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to git-svn.perl +1 −1
diff --git a/git-svn.perl b/git-svn.perl
index 828b8f0..f69a4d6 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -728,7 +728,7 @@ sub populate_merge_info {

  next if $parent eq $parents[0]; # Skip first parent
  # Add new changes being placed in tree by merge
- my @cmd = (qw/rev-list --reverse/,
+ my @cmd = (qw/rev-list --first-parent --reverse/,
    $parent, qw/--not/);
  foreach my $par (@parents) {
  unless ($par eq $parent) {
-- 
1.7.10.msysgit.1
Eric Wong· Sep 14, 2012, 21:50 UTC · re: Avishay Lavie · lore

Re: [PATCH] git svn: Only follow first parents when populating svn:mergeinfo properties

I'm awaiting Sam's comment on this patch.
Avishay Lavie <avishay.lavie@gmail.com> wrote:
Show 43 quoted lines
> Subject: [PATCH] git svn: Only follow first parents when populating
> svn:mergeinfo
>  properties.
> 
> When svn.pushmergeinfo is set, git-svn tries to correctly populate mergeinfo
> properties when encountering a merge commit. It does so by first aggregating
> the mergeinfo property of the merged parent into the target, and then
> adding to it the SVN revision number of any commit reachable from the
> merged parent but not from the first (target) parent.
> 
> If a third branch was merged into the merged parent (e.g. X was merged into Y
> and Y was then merged into Z), its revisions will be listed twice --
> once as part
> of aggregating Y's mergeinfo property into Z's, and once more when walking
> the tree and finding X's commits reachable from Y's tip. While the first listing
> correctly lists those revisions as merged from X, the second listing
> will list them
> as merged from Y, creating incorrect mergeinfo properties that later cause
> unnecessary lookups and warnings when git-svn-fetching.
> 
> Adding '--first-parent' to the rev-list command fixes this by only walking the
> part of the tree that's directly included in the merged branch (Y) and not any
> branches merged into it (X).
> 
> Signed-off-by: Avishay Lavie <avishay.lavie@gmail.com>
> ---
>  git-svn.perl |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 828b8f0..f69a4d6 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -728,7 +728,7 @@ sub populate_merge_info {
> 
>   next if $parent eq $parents[0]; # Skip first parent
>   # Add new changes being placed in tree by merge
> - my @cmd = (qw/rev-list --reverse/,
> + my @cmd = (qw/rev-list --first-parent --reverse/,
>     $parent, qw/--not/);
>   foreach my $par (@parents) {
>   unless ($par eq $parent) {
> -- 

Your patch seems badly whitespace mangled. Fortunately it's a small change and I can fix it by hand.

← back to recent threads