git-svn: fix some mistakes with interpreting SVN mergeinfo commit ranges
SVN's list of commit ranges in mergeinfo tickets is inclusive, whereas git commit ranges are exclusive on the left hand side. Also, the end points of the commit ranges may not exist; they simply delineate ranges of commits which may or may not exist. Fix these two mistakes. Signed-off-by: Sam Vilain <sam@vilain.net> Acked-by: Eric Wong <normalperson@yhbt.net>
Sam Vilain committed
Dec 20, 2009 at 05:22 UTC
33973a5b179278c563624fcb45c223f03031b242
2 files changed
+4
-10
git-svn.perl
+3
-9
@@ -3015,14 +3015,8 @@ sub lookup_svn_merge {
3015
for my $range ( @ranges ) {
3016
my ($bottom, $top) = split "-", $range;
3017
$top ||= $bottom;
3018
- my $bottom_commit =
3019
- $gs->rev_map_get($bottom, $uuid) ||
3020
- $gs->rev_map_get($bottom+1, $uuid);
3021
- my $top_commit;
3022
- for (; !$top_commit && $top >= $bottom; --$top) {
3023
- $top_commit =
3024
- $gs->rev_map_get($top, $uuid);
3025
- }
3018
+ my $bottom_commit = $gs->find_rev_after( $bottom, 1, $top );
3019
+ my $top_commit = $gs->find_rev_before( $top, 1, $bottom );
3020
3021
unless ($top_commit and $bottom_commit) {
3022
warn "W:unknown path/rev in svn:mergeinfo "
@@ -3031,7 +3025,7 @@ sub lookup_svn_merge {
3025
}
3026
3027
push @merged_commit_ranges,
3034
- "$bottom_commit..$top_commit";
3028
+ "$bottom_commit^..$top_commit";
3029
3030
if ( !defined $tip or $top > $tip ) {
3031
$tip = $top;
t/t9151-svn-mergeinfo.sh
+1
-1
@@ -33,7 +33,7 @@ test_expect_success 'svn non-merge merge commits did not become git merge commit
33
[ -z "$bad_non_merges" ]
34
'
35
36
-test_expect_failure 'everything got merged in the end' '
36
+test_expect_success 'everything got merged in the end' '
37
unmerged=$(git rev-list --all --not master)
38
[ -z "$unmerged" ]
39
'