git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Vandiver <alex@chmrr.net>
To: Sam Vilain <sam@vilain.net>, Eric Wong <normalperson@yhbt.net>
Cc: git <git@vger.kernel.org>
Subject: Re: git-svn: SVK merge commits can have >2 parents
Date: Sun, 29 Nov 2009 02:46:49 -0500	[thread overview]
Message-ID: <1259480367-sup-6891@utwig> (raw)
In-Reply-To: <1259479636-sup-573@utwig>

[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]

At Sun Nov 29 02:28:39 -0500 2009, Alex Vandiver wrote:
> While converting a mildly complicated svn repository that was managed
> with SVK, I ran across the following oddness.  `svk smerge` can only
> merge between _two_ branches at once -- however, the way that svk
> merge detection works, you can end up with erroneous extra parents
> from long-dead branches.

Upon a little more inspection, I now understand that the rev-parse
lines in find_extra_svk_parents are attempting to deal with this exact
circumstance -- but they fail to properly sort the merge tickets
first, which leads to this incorrect behavior.  Armed with this
understanding, I'm more confident in the attached updated patch.  I
assume, however, that the logic allows for more than one extra parent
only because such an occurrance could be constructed by hand-editing
svk:merge, because AFAIK svk's command-line tools should be able to
construct such a circumstance.
 - Alex
-- 
Networking -- only one letter away from not working

[-- Attachment #2: 0001-git-svn-sort-svk-merge-tickets-to-account-for-minima.patch --]
[-- Type: application/octet-stream, Size: 1369 bytes --]

From 4d30e57e5da7c2e880908bc742cf80990d6f9f5d Mon Sep 17 00:00:00 2001
From: Alex Vandiver <alex@chmrr.net>
Date: Sun, 29 Nov 2009 02:20:21 -0500
Subject: [PATCH] git-svn: sort svk merge tickets to account for minimal parents

When merging branches based on svk:merge properties, a single merge
can have updated or added multiple svk:merge lines.  Attempt to
include the minimal set of parents by sorting the merge properties in
order of revision, highest to lowest.

Signed-off-by: Alex Vandiver <alex@chmrr.net>
---
 git-svn.perl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-svn.perl b/git-svn.perl
index 957d44e..51f03ad 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2940,10 +2940,14 @@ sub find_extra_svk_parents {
 			if ( my $commit = $gs->rev_map_get($rev, $uuid) ) {
 				# wahey!  we found it, but it might be
 				# an old one (!)
-				push @known_parents, $commit;
+				push @known_parents, [ $rev, $commit ];
 			}
 		}
 	}
+	# Ordering matters; highest-numbered commit merge tickets
+	# first, as they may account for later merge ticket additions
+	# or changes.
+	@known_parents = map {$_->[1]} sort {$b->[0] <=> $a->[0]} @known_parents;
 	for my $parent ( @known_parents ) {
 		my @cmd = ('rev-list', $parent, map { "^$_" } @$parents );
 		my ($msg_fh, $ctx) = command_output_pipe(@cmd);
-- 
1.6.6.rc0.254.g7352d


  reply	other threads:[~2009-11-29  7:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-29  7:28 git-svn: SVK merge commits can have >2 parents Alex Vandiver
2009-11-29  7:46 ` Alex Vandiver [this message]
2009-11-29  8:08   ` Eric Wong
2009-11-29 11:26     ` [spf:guess] " Sam Vilain
2009-11-29 20:47       ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259480367-sup-6891@utwig \
    --to=alex@chmrr.net \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    --cc=sam@vilain.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).