summaryrefslogtreecommitdiff
path: root/git-svn.perl
diff options
context:
space:
mode:
authorToby Allsopp <toby.allsopp@navman.co.nz>2009-11-14 13:26:47 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-14 13:37:59 -0800
commit753dc384dc2c4ab3e1049f695425cebf41ff7e6b (patch)
tree190eaf2cc62d42bda00f2d65a5dbf8f92b8468a0 /git-svn.perl
parentc5b3e0f54950f983836970050406347ddf82b152 (diff)
downloadgit-753dc384dc2c4ab3e1049f695425cebf41ff7e6b.tar.gz
git svn: handle SVN merges from revisions past the tip of the branch
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. [ew: This includes the following (squashed) commit to prevent errors during bisect:] Author: Toby Allsopp <toby.allsopp@navman.co.nz> Date: Fri Nov 13 09:48:39 2009 +1300 git-svn: add (failing) test for SVN 1.5+ merge with intervening commit This test exposes a bug in git-svn's handling of SVN 1.5+ mergeinfo properties. The problematic case is when there is some commit on an unrelated branch after the last commit on the merged-from branch. When SVN records the mergeinfo property, it records the latest revision in the whole repository, which, in the problematic case, is not on the branch it is merging from. To trigger the git-svn bug, we modify t9151 to include two SVN merges, the second of which has an intervening commit. The SVN dump was generated using SVN 1.6.6 (on Debian squeeze amd64). Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz> Acked-by: Eric Wong <normalperson@yhbt.net>
Diffstat (limited to 'git-svn.perl')
-rwxr-xr-xgit-svn.perl7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-svn.perl b/git-svn.perl
index 6a3b501d24..27fbe3063b 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 "