* [PATCH 2/2] git-svn: handle SVN merges from revisions past the tip of the branch
@ 2009-11-12 20:18 Toby Allsopp
2009-11-13 0:47 ` Sam Vilain
0 siblings, 1 reply; 3+ messages in thread
From: Toby Allsopp @ 2009-11-12 20:18 UTC (permalink / raw)
To: git; +Cc: Sam Vilain, Eric Wong
When recording the revisions that it has merged, SVN sets the top
revision to be the latest revision in the repository, which is not
necessarily a revision on the branch that is being merged from. When
it is not on the branch, git-svn fails to add the extra parent to
represent the merge because it relies on finding the commit on the
branch that corresponds to the top of the SVN merge range.
In order to correctly handle this case, we look for the maximum
revision less than or equal to the top of the SVN merge range that is
actually on the branch being merged from.
Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
---
git-svn.perl | 7 +++++--
t/t9151-svn-mergeinfo.sh | 2 +-
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-svn.perl b/git-svn.perl
index 6a3b501..27fbe30 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -2950,8 +2950,11 @@ sub find_extra_svn_parents {
my $bottom_commit =
$gs->rev_map_get($bottom, $self->ra_uuid) ||
$gs->rev_map_get($bottom+1, $self->ra_uuid);
- my $top_commit =
- $gs->rev_map_get($top, $self->ra_uuid);
+ my $top_commit;
+ for (; !$top_commit && $top >= $bottom; --$top) {
+ $top_commit =
+ $gs->rev_map_get($top, $self->ra_uuid);
+ }
unless ($top_commit and $bottom_commit) {
warn "W:unknown path/rev in svn:mergeinfo "
diff --git a/t/t9151-svn-mergeinfo.sh b/t/t9151-svn-mergeinfo.sh
index 0d42c84..f57daf4 100755
--- a/t/t9151-svn-mergeinfo.sh
+++ b/t/t9151-svn-mergeinfo.sh
@@ -19,7 +19,7 @@ test_expect_success 'represent svn merges without intervening commits' "
[ `git cat-file commit HEAD^1 | grep parent | wc -l` -eq 2 ]
"
-test_expect_failure 'represent svn merges with intervening commits' "
+test_expect_success 'represent svn merges with intervening commits' "
[ `git cat-file commit HEAD | grep parent | wc -l` -eq 2 ]
"
--
1.6.5.2.155.gbb47.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] git-svn: handle SVN merges from revisions past the tip of the branch
2009-11-12 20:18 [PATCH 2/2] git-svn: handle SVN merges from revisions past the tip of the branch Toby Allsopp
@ 2009-11-13 0:47 ` Sam Vilain
2009-11-13 1:03 ` Toby Allsopp
0 siblings, 1 reply; 3+ messages in thread
From: Sam Vilain @ 2009-11-13 0:47 UTC (permalink / raw)
To: Toby Allsopp; +Cc: git, Eric Wong
Toby Allsopp wrote:
> When recording the revisions that it has merged, SVN sets the top
> revision to be the latest revision in the repository, which is not
> necessarily a revision on the branch that is being merged from. When
> it is not on the branch, git-svn fails to add the extra parent to
> represent the merge because it relies on finding the commit on the
> branch that corresponds to the top of the SVN merge range.
I thought, "that sounds like he's repeating himself, wait a sec..."
> -test_expect_failure 'represent svn merges with intervening commits' "
> +test_expect_success 'represent svn merges with intervening commits' "
> [ `git cat-file commit HEAD | grep parent | wc -l` -eq 2 ]
> "
So you made a failing test and then added the implementation for it?
Interesting strategy :). I'd probably not repeat the same sentence
twice though.
Thanks for contributing this. There might be other bugs too, especially
when upstream has a more complicated merge hierarchy ... apparently svn
tends to get it wrong, so checking for all commits might not work in
that case.
It would be nice if "dcommit" could make these commits, too...
Sam
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] git-svn: handle SVN merges from revisions past the tip of the branch
2009-11-13 0:47 ` Sam Vilain
@ 2009-11-13 1:03 ` Toby Allsopp
0 siblings, 0 replies; 3+ messages in thread
From: Toby Allsopp @ 2009-11-13 1:03 UTC (permalink / raw)
To: Sam Vilain; +Cc: git, Eric Wong
On Fri, Nov 13 2009, Sam Vilain wrote:
> Toby Allsopp wrote:
> > When recording the revisions that it has merged, SVN sets the top
> > revision to be the latest revision in the repository, which is not
> > necessarily a revision on the branch that is being merged from. When
> > it is not on the branch, git-svn fails to add the extra parent to
> > represent the merge because it relies on finding the commit on the
> > branch that corresponds to the top of the SVN merge range.
>
> I thought, "that sounds like he's repeating himself, wait a sec..."
Hmm, it makes perfect sense to me :-) Does the explanation in 1/2 make
more sense?
The first sentence describes what Subversion does, the second what
git-svn does in response.
> Thanks for contributing this. There might be other bugs too, especially
> when upstream has a more complicated merge hierarchy ... apparently svn
> tends to get it wrong, so checking for all commits might not work in
> that case.
Oh yes, SVN gets the merges wrong in an alarming number of cases, it's
really shocking. I only stay sane at work because I tell myself that
SVN is making the case for git for me :-)
> It would be nice if "dcommit" could make these commits, too...
Yes.
Toby.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-13 1:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 20:18 [PATCH 2/2] git-svn: handle SVN merges from revisions past the tip of the branch Toby Allsopp
2009-11-13 0:47 ` Sam Vilain
2009-11-13 1:03 ` Toby Allsopp
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.