From ce62683096d144749c77e557ecd21c91b840b0f1 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Tue, 20 Oct 2009 15:42:02 +1300 Subject: git-svn: add test data for SVN 1.5+ merge, with script. Dump generated with SVN 1.5.1 (on lenny amd64). This test should hopefully cover all but a few intermediate versions of the svnmerge.py script. Signed-off-by: Sam Vilain Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 73 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 t/t9151/make-svnmerge-dump (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump new file mode 100644 index 0000000000..e35d64d585 --- /dev/null +++ b/t/t9151/make-svnmerge-dump @@ -0,0 +1,73 @@ +#!/bin/sh +# +# this script sets up a Subversion repository for Makefile in the +# first ever git merge, as if it were done with svnmerge (SVN 1.5+) +# + +rm -rf foo.svn foo +set -e + +mkdir foo.svn +svnadmin create foo.svn +svn co file://`pwd`/foo.svn foo + +cd foo +mkdir trunk +mkdir branches +svn add trunk branches +svn commit -m "Setup trunk and branches" +cd trunk + +git cat-file blob 6683463e:Makefile > Makefile +svn add Makefile + +echo "Committing ANCESTOR" +svn commit -m "ancestor" +cd .. +svn cp trunk branches/left + +echo "Committing BRANCH POINT" +svn commit -m "make left branch" +cd branches/left/ + +#$sm init +#svn commit -m "init svnmerge" + +git cat-file blob 5873b67e:Makefile > Makefile +echo "Committing BRANCH UPDATE 1" +svn commit -m "left update 1" +cd ../.. + +cd trunk +git cat-file blob 75118b13:Makefile > Makefile +echo "Committing TRUNK UPDATE" +svn commit -m "trunk update" + +cd ../branches/left +git cat-file blob ff5ebe39:Makefile > Makefile +echo "Committing BRANCH UPDATE 2" +svn commit -m "left update 2" + +git cat-file blob b5039db6:Makefile > Makefile +echo "Committing BRANCH UPDATE 3" +svn commit -m "left update 3" + +# merge to trunk + +cd ../.. +svn update +cd trunk + +svn merge ../branches/left --accept postpone + +git cat-file blob b51ad431:Makefile > Makefile + +svn resolved Makefile + +svn commit -m "Merge trunk" + +cd ../.. + +svnadmin dump foo.svn > svn-mergeinfo.dump + +rm -rf foo foo.svn -- cgit v1.2.3 From 753dc384dc2c4ab3e1049f695425cebf41ff7e6b Mon Sep 17 00:00:00 2001 From: Toby Allsopp Date: Sat, 14 Nov 2009 13:26:47 -0800 Subject: 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 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 Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index e35d64d585..7e3da75f86 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -28,6 +28,10 @@ svn cp trunk branches/left echo "Committing BRANCH POINT" svn commit -m "make left branch" +svn cp trunk branches/right + +echo "Committing other BRANCH POINT" +svn commit -m "make right branch" cd branches/left/ #$sm init @@ -64,7 +68,33 @@ git cat-file blob b51ad431:Makefile > Makefile svn resolved Makefile -svn commit -m "Merge trunk" +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 +echo "Committing other BRANCH UPDATE 1" +svn commit -m "right update 1" + +# merge to trun again + +cd ../.. +svn update +cd trunk + +svn merge ../branches/left --accept postpone + +git cat-file blob b51ad431:Makefile > Makefile + +svn resolved Makefile + +svn commit -m "Merge trunk 2" cd ../.. -- cgit v1.2.3 From 1d144aa25edbb4dcda88abbaef8f336108b8d788 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Sun, 20 Dec 2009 05:20:30 +1300 Subject: 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 Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 166 ++++++++++++++++++++++++++++++--------------- 1 file changed, 112 insertions(+), 54 deletions(-) (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index 7e3da75f86..d917717cf3 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -11,93 +11,151 @@ mkdir foo.svn svnadmin create foo.svn 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 " * $*" +} + +i=0 cd foo mkdir trunk mkdir branches svn add trunk branches -svn commit -m "Setup trunk and branches" -cd trunk +i=$(commit $i "Setup trunk and branches") -git cat-file blob 6683463e:Makefile > Makefile -svn add Makefile +git cat-file blob 6683463e:Makefile > trunk/Makefile +svn add trunk/Makefile -echo "Committing ANCESTOR" -svn commit -m "ancestor" -cd .. +say "Committing ANCESTOR" +i=$(commit $i "ancestor") svn cp trunk branches/left -echo "Committing BRANCH POINT" -svn commit -m "make left branch" +say "Committing BRANCH POINT" +i=$(commit $i "make left branch") svn cp trunk branches/right -echo "Committing other BRANCH POINT" -svn commit -m "make right branch" -cd branches/left/ +say "Committing other BRANCH POINT" +i=$(commit $i "make right branch") -#$sm init -#svn commit -m "init svnmerge" +say "Committing LEFT UPDATE" +git cat-file blob 5873b67e:Makefile > branches/left/Makefile +i=$(commit $i "left update 1") -git cat-file blob 5873b67e:Makefile > Makefile -echo "Committing BRANCH UPDATE 1" -svn commit -m "left update 1" -cd ../.. - -cd trunk -git cat-file blob 75118b13:Makefile > Makefile -echo "Committing TRUNK UPDATE" -svn commit -m "trunk update" +git cat-file blob 75118b13:Makefile > branches/right/Makefile +say "Committing RIGHT UPDATE" +pre_right_update_1=$i +i=$(commit $i "right update 1") -cd ../branches/left -git cat-file blob ff5ebe39:Makefile > Makefile -echo "Committing BRANCH UPDATE 2" -svn commit -m "left update 2" +say "Making more commits on LEFT" +git cat-file blob ff5ebe39:Makefile > branches/left/Makefile +i=$(commit $i "left update 2") +git cat-file blob b5039db6:Makefile > branches/left/Makefile +i=$(commit $i "left update 3") -git cat-file blob b5039db6:Makefile > Makefile -echo "Committing BRANCH UPDATE 3" -svn commit -m "left update 3" +say "Making a LEFT SUB-BRANCH" +svn cp branches/left branches/left-sub +sub_left_make=$i +i=$(commit $i "make left sub-branch") -# merge to trunk +say "Making a commit on LEFT SUB-BRANCH" +echo "crunch" > branches/left-sub/README +svn add branches/left-sub/README +i=$(commit $i "left sub-branch update 1") -cd ../.. +say "Merging LEFT to TRUNK" svn update cd trunk - svn merge ../branches/left --accept postpone - -git cat-file blob b51ad431:Makefile > Makefile - +git cat-file blob b5039db6:Makefile > Makefile svn resolved Makefile +i=$(commit $i "Merge left to trunk 1") +cd .. -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 -echo "Committing other BRANCH UPDATE 1" -svn commit -m "right update 1" +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") -# merge to trun again +say "Squash merge of RIGHT tip 2 commits onto TRUNK" +svn update +cd trunk +svn merge -r$pre_right_update_1:$i ../branches/right +i=$(commit $i "Cherry-pick right 2 commits to trunk") +cd .. -cd ../.. +say "Merging RIGHT to TRUNK" svn update cd trunk +svn merge ../branches/right --accept postpone +git cat-file blob b51ad431:Makefile > Makefile +svn resolved Makefile +i=$(commit $i "Merge right to trunk 1") +cd .. -svn merge ../branches/left --accept postpone +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 ../.. -svn commit -m "Merge trunk 2" +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 rm -rf foo foo.svn -- cgit v1.2.3 From c79f1189bc4e7d9bb9cb673c043ce8f587a9a92d Mon Sep 17 00:00:00 2001 From: Andrew Myrick Date: Thu, 21 Jan 2010 21:55:48 +0000 Subject: git-svn: update svn mergeinfo test suite Add a partial branch (e.g., a branch from a project subdirectory) to the git-svn mergeinfo test repository. Add a tag and a branch from that tag to the git-svn mergeinfo test repository. Update the test script to expect a known failure in git-svn exposed by these additions where merge info for partial branches is not preserved. Signed-off-by: Andrew Myrick Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 65 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index d917717cf3..3d73f140f8 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -26,8 +26,9 @@ i=0 cd foo mkdir trunk mkdir branches -svn add trunk branches -i=$(commit $i "Setup trunk and branches") +mkdir tags +svn add trunk branches tags +i=$(commit $i "Setup trunk, branches, and tags") git cat-file blob 6683463e:Makefile > trunk/Makefile svn add trunk/Makefile @@ -155,6 +156,66 @@ svn merge ../branches/right --accept postpone i=$(commit $i "non-merge right to trunk 2") cd .. +say "Adding subdirectory to LEFT" +svn update +cd branches/left +mkdir subdir +echo "Yeehaw" > subdir/cowboy +svn add subdir +i=$(commit $i "add subdirectory to left branch") +cd ../../ + +say "Merging LEFT to TRUNK" +svn update +cd trunk +svn merge ../branches/left --accept postpone +i=$(commit $i "merge left to trunk") +cd .. + +say "Make PARTIAL branch" +svn update +i=$(commit $i "make partial branch") +svn cp trunk/subdir branches/partial + +say "Make a commit to PARTIAL" +svn update +cd branches/partial +echo "racecar" > palindromes +svn add palindromes +i=$(commit $i "partial update") +cd ../../ + +say "Merge PARTIAL to TRUNK" +svn update +cd trunk/subdir +svn merge ../../branches/partial --accept postpone +i=$(commit $i "merge partial to trunk") +cd ../../ + +say "Tagging trunk" +svn update +i=$(commit $i "tagging v1.0") +svn cp trunk tags/v1.0 + +say "Branching BUGFIX from v1.0" +svn update +i=$(commit $i "make bugfix branch from tag") +svn cp tags/v1.0 branches/bugfix + +say "Make a commit to BUGFIX" +svn update +cd branches/bugfix/ +echo "kayak" >> subdir/palindromes +i=$(commit $i "commit to bugfix") +cd ../../ + +say "Merge BUGFIX to TRUNK" +svn update +cd trunk +svn merge ../branches/bugfix/ --accept postpone +i=$(commit $i "Merge BUGFIX to TRUNK") +cd .. + cd .. svnadmin dump foo.svn > svn-mergeinfo.dump -- cgit v1.2.3 From ae5b370c9bbc161c68059cea7d9f7eb5b556e050 Mon Sep 17 00:00:00 2001 From: Tuomas Suutari Date: Mon, 22 Feb 2010 09:57:20 +0200 Subject: t9151: Fix a few commits in the SVN dump A few "svn cp" commands and commit commands were executed in incorrect order. Therefore some of the desired commits were missing and some were committed with wrong revision number in the commit message. This made it hard to compare the produced git repository with the SVN repository. The dump file is updated too, but only the relevant parts and with hand-edited timestamps to make history linear. Signed-off-by: Tuomas Suutari Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index 3d73f140f8..3168c7ce2d 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -174,8 +174,8 @@ cd .. say "Make PARTIAL branch" svn update -i=$(commit $i "make partial branch") svn cp trunk/subdir branches/partial +i=$(commit $i "make partial branch") say "Make a commit to PARTIAL" svn update @@ -194,13 +194,13 @@ cd ../../ say "Tagging trunk" svn update -i=$(commit $i "tagging v1.0") svn cp trunk tags/v1.0 +i=$(commit $i "tagging v1.0") say "Branching BUGFIX from v1.0" svn update -i=$(commit $i "make bugfix branch from tag") svn cp tags/v1.0 branches/bugfix +i=$(commit $i "make bugfix branch from tag") say "Make a commit to BUGFIX" svn update -- cgit v1.2.3 From 9560808f2ef5a34d2a69c454cfa6003a2f8467cb Mon Sep 17 00:00:00 2001 From: Tuomas Suutari Date: Mon, 22 Feb 2010 09:57:21 +0200 Subject: t9151: Add two new svn:mergeinfo test cases When svn:mergeinfo contains two new parents in a specific order and one is ancestor of the other, it is possible that git-svn discards the wrong one. The first test case ("commit made to merged branch is reachable from the merge") proves this. The second test case ("merging two branches in one commit is detected correctly") is just for completeness, since there was no test for merging two (feature) branches to trunk in one commit. Signed-off-by: Tuomas Suutari Acked-by: Eric Wong --- t/t9151/make-svnmerge-dump | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 't/t9151/make-svnmerge-dump') diff --git a/t/t9151/make-svnmerge-dump b/t/t9151/make-svnmerge-dump index 3168c7ce2d..e1e138cb1a 100644 --- a/t/t9151/make-svnmerge-dump +++ b/t/t9151/make-svnmerge-dump @@ -156,6 +156,89 @@ svn merge ../branches/right --accept postpone i=$(commit $i "non-merge right to trunk 2") cd .. +say "Branching b1 from trunk" +svn update +svn cp trunk branches/b1 +i=$(commit $i "make b1 branch from trunk") + +say "Branching b2 from trunk" +svn update +svn cp trunk branches/b2 +i=$(commit $i "make b2 branch from trunk") + +say "Make a commit to b2" +svn update +cd branches/b2 +echo "b2" > b2file +svn add b2file +i=$(commit $i "b2 update 1") +cd ../.. + +say "Make a commit to b1" +svn update +cd branches/b1 +echo "b1" > b1file +svn add b1file +i=$(commit $i "b1 update 1") +cd ../.. + +say "Merge b1 to trunk" +svn update +cd trunk +svn merge ../branches/b1/ --accept postpone +i=$(commit $i "Merge b1 to trunk") +cd .. + +say "Make a commit to trunk before merging trunk to b2" +svn update +cd trunk +echo "trunk" > trunkfile +svn add trunkfile +i=$(commit $i "trunk commit before merging trunk to b2") +cd .. + +say "Merge trunk to b2" +svn update +cd branches/b2 +svn merge ../../trunk/ --accept postpone +i=$(commit $i "Merge trunk to b2") +cd ../.. + +say "Merge b2 to trunk" +svn update +cd trunk +svn merge ../branches/b2/ --accept postpone +svn resolved b1file +svn resolved trunkfile +i=$(commit $i "Merge b2 to trunk") +cd .. + +say "Creating f1 from trunk with a new file" +svn update +svn cp trunk branches/f1 +cd branches/f1 +echo "f1" > f1file +svn add f1file +cd ../.. +i=$(commit $i "make f1 branch from trunk with a new file") + +say "Creating f2 from trunk with a new file" +svn update +svn cp trunk branches/f2 +cd branches/f2 +echo "f2" > f2file +svn add f2file +cd ../.. +i=$(commit $i "make f2 branch from trunk with a new file") + +say "Merge f1 and f2 to trunk in one go" +svn update +cd trunk +svn merge ../branches/f1/ --accept postpone +svn merge ../branches/f2/ --accept postpone +i=$(commit $i "Merge f1 and f2 to trunk") +cd .. + say "Adding subdirectory to LEFT" svn update cd branches/left -- cgit v1.2.3