git-svn: expand the svn mergeinfo test suite, highlighting some failures
As shown, git-svn has some problems; not all svn merges are correctly detected, and cherry picks may incorrectly be detected as real merges. These test cases will be marked as _success once the relevant fixes are in. Signed-off-by: Sam Vilain <sam@vilain.net> Acked-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
parent
af57b41d41
commit
1d144aa25e
@ -15,12 +15,27 @@ test_expect_success 'load svn dump' "
|
|||||||
git svn fetch --all
|
git svn fetch --all
|
||||||
"
|
"
|
||||||
|
|
||||||
test_expect_success 'represent svn merges without intervening commits' "
|
test_expect_failure 'all svn merges became git merge commits' '
|
||||||
[ `git cat-file commit HEAD^1 | grep parent | wc -l` -eq 2 ]
|
unmarked=$(git rev-list --parents --all --grep=Merge |
|
||||||
"
|
grep -v " .* " | cut -f1 -d" ")
|
||||||
|
[ -z "$unmarked" ]
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'represent svn merges with intervening commits' "
|
test_expect_failure 'cherry picks did not become git merge commits' '
|
||||||
[ `git cat-file commit HEAD | grep parent | wc -l` -eq 2 ]
|
bad_cherries=$(git rev-list --parents --all --grep=Cherry |
|
||||||
"
|
grep " .* " | cut -f1 -d" ")
|
||||||
|
[ -z "$bad_cherries" ]
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'svn non-merge merge commits did not become git merge commits' '
|
||||||
|
bad_non_merges=$(git rev-list --parents --all --grep=non-merge |
|
||||||
|
grep " .* " | cut -f1 -d" ")
|
||||||
|
[ -z "$bad_non_merges" ]
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_failure 'everything got merged in the end' '
|
||||||
|
unmerged=$(git rev-list --all --not master)
|
||||||
|
[ -z "$unmerged" ]
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -11,93 +11,151 @@ mkdir foo.svn
|
|||||||
svnadmin create foo.svn
|
svnadmin create foo.svn
|
||||||
svn co file://`pwd`/foo.svn foo
|
svn co file://`pwd`/foo.svn foo
|
||||||
|
|
||||||
|
commit() {
|
||||||
|
i=$(( $1 + 1 ))
|
||||||
|
shift;
|
||||||
|
svn commit -m "(r$i) $*" >/dev/null || exit 1
|
||||||
|
echo $i
|
||||||
|
}
|
||||||
|
|
||||||
|
say() {
|
||||||
|
echo "[1m * $*[0m"
|
||||||
|
}
|
||||||
|
|
||||||
|
i=0
|
||||||
cd foo
|
cd foo
|
||||||
mkdir trunk
|
mkdir trunk
|
||||||
mkdir branches
|
mkdir branches
|
||||||
svn add trunk branches
|
svn add trunk branches
|
||||||
svn commit -m "Setup trunk and branches"
|
i=$(commit $i "Setup trunk and branches")
|
||||||
cd trunk
|
|
||||||
|
|
||||||
git cat-file blob 6683463e:Makefile > Makefile
|
git cat-file blob 6683463e:Makefile > trunk/Makefile
|
||||||
svn add Makefile
|
svn add trunk/Makefile
|
||||||
|
|
||||||
echo "Committing ANCESTOR"
|
say "Committing ANCESTOR"
|
||||||
svn commit -m "ancestor"
|
i=$(commit $i "ancestor")
|
||||||
cd ..
|
|
||||||
svn cp trunk branches/left
|
svn cp trunk branches/left
|
||||||
|
|
||||||
echo "Committing BRANCH POINT"
|
say "Committing BRANCH POINT"
|
||||||
svn commit -m "make left branch"
|
i=$(commit $i "make left branch")
|
||||||
svn cp trunk branches/right
|
svn cp trunk branches/right
|
||||||
|
|
||||||
echo "Committing other BRANCH POINT"
|
say "Committing other BRANCH POINT"
|
||||||
svn commit -m "make right branch"
|
i=$(commit $i "make right branch")
|
||||||
cd branches/left/
|
|
||||||
|
|
||||||
#$sm init
|
say "Committing LEFT UPDATE"
|
||||||
#svn commit -m "init svnmerge"
|
git cat-file blob 5873b67e:Makefile > branches/left/Makefile
|
||||||
|
i=$(commit $i "left update 1")
|
||||||
|
|
||||||
git cat-file blob 5873b67e:Makefile > Makefile
|
git cat-file blob 75118b13:Makefile > branches/right/Makefile
|
||||||
echo "Committing BRANCH UPDATE 1"
|
say "Committing RIGHT UPDATE"
|
||||||
svn commit -m "left update 1"
|
pre_right_update_1=$i
|
||||||
cd ../..
|
i=$(commit $i "right update 1")
|
||||||
|
|
||||||
cd trunk
|
say "Making more commits on LEFT"
|
||||||
git cat-file blob 75118b13:Makefile > Makefile
|
git cat-file blob ff5ebe39:Makefile > branches/left/Makefile
|
||||||
echo "Committing TRUNK UPDATE"
|
i=$(commit $i "left update 2")
|
||||||
svn commit -m "trunk update"
|
git cat-file blob b5039db6:Makefile > branches/left/Makefile
|
||||||
|
i=$(commit $i "left update 3")
|
||||||
|
|
||||||
cd ../branches/left
|
say "Making a LEFT SUB-BRANCH"
|
||||||
git cat-file blob ff5ebe39:Makefile > Makefile
|
svn cp branches/left branches/left-sub
|
||||||
echo "Committing BRANCH UPDATE 2"
|
sub_left_make=$i
|
||||||
svn commit -m "left update 2"
|
i=$(commit $i "make left sub-branch")
|
||||||
|
|
||||||
git cat-file blob b5039db6:Makefile > Makefile
|
say "Making a commit on LEFT SUB-BRANCH"
|
||||||
echo "Committing BRANCH UPDATE 3"
|
echo "crunch" > branches/left-sub/README
|
||||||
svn commit -m "left update 3"
|
svn add branches/left-sub/README
|
||||||
|
i=$(commit $i "left sub-branch update 1")
|
||||||
|
|
||||||
# merge to trunk
|
say "Merging LEFT to TRUNK"
|
||||||
|
|
||||||
cd ../..
|
|
||||||
svn update
|
svn update
|
||||||
cd trunk
|
cd trunk
|
||||||
|
|
||||||
svn merge ../branches/left --accept postpone
|
svn merge ../branches/left --accept postpone
|
||||||
|
|
||||||
git cat-file blob b51ad431:Makefile > Makefile
|
|
||||||
|
|
||||||
svn resolved Makefile
|
|
||||||
|
|
||||||
svn commit -m "Merge trunk 1"
|
|
||||||
|
|
||||||
# create commits on both branches
|
|
||||||
|
|
||||||
cd ../branches/left
|
|
||||||
git cat-file blob ff5ebe39:Makefile > Makefile
|
|
||||||
echo "Committing BRANCH UPDATE 4"
|
|
||||||
svn commit -m "left update 4"
|
|
||||||
|
|
||||||
cd ../right
|
|
||||||
git cat-file blob b5039db6:Makefile > Makefile
|
git cat-file blob b5039db6:Makefile > Makefile
|
||||||
echo "Committing other BRANCH UPDATE 1"
|
svn resolved Makefile
|
||||||
svn commit -m "right update 1"
|
i=$(commit $i "Merge left to trunk 1")
|
||||||
|
cd ..
|
||||||
|
|
||||||
# merge to trun again
|
say "Making more commits on LEFT and RIGHT"
|
||||||
|
echo "touche" > branches/left/zlonk
|
||||||
|
svn add branches/left/zlonk
|
||||||
|
i=$(commit $i "left update 4")
|
||||||
|
echo "thwacke" > branches/right/bang
|
||||||
|
svn add branches/right/bang
|
||||||
|
i=$(commit $i "right update 2")
|
||||||
|
|
||||||
cd ../..
|
say "Squash merge of RIGHT tip 2 commits onto TRUNK"
|
||||||
svn update
|
svn update
|
||||||
cd trunk
|
cd trunk
|
||||||
|
svn merge -r$pre_right_update_1:$i ../branches/right
|
||||||
|
i=$(commit $i "Cherry-pick right 2 commits to trunk")
|
||||||
|
cd ..
|
||||||
|
|
||||||
svn merge ../branches/left --accept postpone
|
say "Merging RIGHT to TRUNK"
|
||||||
|
svn update
|
||||||
|
cd trunk
|
||||||
|
svn merge ../branches/right --accept postpone
|
||||||
git cat-file blob b51ad431:Makefile > Makefile
|
git cat-file blob b51ad431:Makefile > Makefile
|
||||||
|
|
||||||
svn resolved Makefile
|
svn resolved Makefile
|
||||||
|
i=$(commit $i "Merge right to trunk 1")
|
||||||
|
cd ..
|
||||||
|
|
||||||
svn commit -m "Merge trunk 2"
|
say "Making more commits on RIGHT and TRUNK"
|
||||||
|
echo "whamm" > branches/right/urkkk
|
||||||
|
svn add branches/right/urkkk
|
||||||
|
i=$(commit $i "right update 3")
|
||||||
|
echo "pow" > trunk/vronk
|
||||||
|
svn add trunk/vronk
|
||||||
|
i=$(commit $i "trunk update 1")
|
||||||
|
|
||||||
|
say "Merging RIGHT to LEFT SUB-BRANCH"
|
||||||
|
svn update
|
||||||
|
cd branches/left-sub
|
||||||
|
svn merge ../right --accept postpone
|
||||||
|
git cat-file blob b51ad431:Makefile > Makefile
|
||||||
|
svn resolved Makefile
|
||||||
|
i=$(commit $i "Merge right to left sub-branch")
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
|
say "Making more commits on LEFT SUB-BRANCH and LEFT"
|
||||||
|
echo "zowie" > branches/left-sub/wham_eth
|
||||||
|
svn add branches/left-sub/wham_eth
|
||||||
|
pre_sub_left_update_2=$i
|
||||||
|
i=$(commit $i "left sub-branch update 2")
|
||||||
|
sub_left_update_2=$i
|
||||||
|
echo "eee_yow" > branches/left/glurpp
|
||||||
|
svn add branches/left/glurpp
|
||||||
|
i=$(commit $i "left update 5")
|
||||||
|
|
||||||
|
say "Cherry pick LEFT SUB-BRANCH commit to LEFT"
|
||||||
|
svn update
|
||||||
|
cd branches/left
|
||||||
|
svn merge -r$pre_sub_left_update_2:$sub_left_update_2 ../left-sub
|
||||||
|
i=$(commit $i "Cherry-pick left sub-branch commit to left")
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
say "Merging LEFT SUB-BRANCH back to LEFT"
|
||||||
|
svn update
|
||||||
|
cd branches/left
|
||||||
|
# it's only a merge because the previous merge cherry-picked the top commit
|
||||||
|
svn merge -r$sub_left_make:$sub_left_update_2 ../left-sub --accept postpone
|
||||||
|
i=$(commit $i "Merge left sub-branch to left")
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
say "Merging EVERYTHING to TRUNK"
|
||||||
|
svn update
|
||||||
|
cd trunk
|
||||||
|
svn merge ../branches/left --accept postpone
|
||||||
|
svn resolved bang
|
||||||
|
i=$(commit $i "Merge left to trunk 2")
|
||||||
|
# this merge, svn happily updates the mergeinfo, but there is actually
|
||||||
|
# nothing to merge. git-svn will not make a meaningless merge commit.
|
||||||
|
svn merge ../branches/right --accept postpone
|
||||||
|
i=$(commit $i "non-merge right to trunk 2")
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd ..
|
||||||
svnadmin dump foo.svn > svn-mergeinfo.dump
|
svnadmin dump foo.svn > svn-mergeinfo.dump
|
||||||
|
|
||||||
rm -rf foo foo.svn
|
rm -rf foo foo.svn
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user