diff options
Diffstat (limited to 'tests/test-subrepo-svn.t')
-rw-r--r-- | tests/test-subrepo-svn.t | 346 |
1 files changed, 153 insertions, 193 deletions
diff --git a/tests/test-subrepo-svn.t b/tests/test-subrepo-svn.t index ba9611d..97bf860 100644 --- a/tests/test-subrepo-svn.t +++ b/tests/test-subrepo-svn.t @@ -1,38 +1,45 @@ - $ "$TESTDIR/hghave" svn15 || exit 80 + $ "$TESTDIR/hghave" svn || exit 80 - $ SVNREPOPATH=`pwd`/svn-repo -#if windows - $ SVNREPOURL=file:///`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` -#else - $ SVNREPOURL=file://`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$SVNREPOPATH"` -#endif + $ fix_path() + > { + > tr '\\' / + > } + +SVN wants all paths to start with a slash. Unfortunately, Windows ones +don't. Handle that. + + $ escapedwd=`pwd | fix_path` + $ expr "$escapedwd" : '\/' > /dev/null || escapedwd="/$escapedwd" + $ escapedwd=`python -c "import urllib, sys; sys.stdout.write(urllib.quote(sys.argv[1]))" "$escapedwd"` create subversion repo + $ SVNREPO="file://$escapedwd/svn-repo" $ WCROOT="`pwd`/svn-wc" $ svnadmin create svn-repo - $ svn co "$SVNREPOURL" svn-wc + $ svn co "$SVNREPO" svn-wc Checked out revision 0. $ cd svn-wc $ mkdir src $ echo alpha > src/alpha $ svn add src A src - A src/alpha (glob) + A src/alpha $ mkdir externals $ echo other > externals/other $ svn add externals A externals - A externals/other (glob) + A externals/other $ svn ci -m 'Add alpha' Adding externals - Adding externals/other (glob) + Adding externals/other Adding src - Adding src/alpha (glob) + Adding src/alpha Transmitting file data .. Committed revision 1. - $ svn up -q - $ echo "externals -r1 $SVNREPOURL/externals" > extdef + $ svn up + At revision 1. + $ echo "externals -r1 $SVNREPO/externals" > extdef $ svn propset -F extdef svn:externals src property 'svn:externals' set on 'src' $ svn ci -m 'Setting externals' @@ -56,13 +63,15 @@ first revision, no sub add first svn sub with leading whitespaces - $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub - $ echo "subdir/s = [svn] $SVNREPOURL/src" >> .hgsub - $ svn co --quiet "$SVNREPOURL"/src s + $ echo "s = [svn] $SVNREPO/src" >> .hgsub + $ echo "subdir/s = [svn] $SVNREPO/src" >> .hgsub + $ svn co --quiet "$SVNREPO"/src s $ mkdir subdir - $ svn co --quiet "$SVNREPOURL"/src subdir/s + $ svn co --quiet "$SVNREPO"/src subdir/s $ hg add .hgsub $ hg ci -m1 + committing subrepository s + committing subrepository subdir/s make sure we avoid empty commits (issue2445) @@ -96,13 +105,13 @@ change file in svn and hg, commit branch: default commit: 1 modified, 1 subrepos update: (current) - $ hg commit --subrepos -m 'Message!' | grep -v Updating + $ hg commit -m 'Message!' committing subrepository s Sending*s/alpha (glob) Transmitting file data . Committed revision 3. - Fetching external item into '*s/externals'* (glob) + Fetching external item into '$TESTTMP/sub/t/s/externals' External at revision 1. At revision 3. @@ -114,22 +123,18 @@ change file in svn and hg, commit source file://*/svn-repo/src (glob) revision 2 -missing svn file, commit should fail - - $ rm s/alpha - $ hg commit --subrepos -m 'abort on missing file' - committing subrepository s - abort: cannot commit missing svn entries - [255] - $ svn revert s/alpha > /dev/null - add an unrelated revision in svn and update the subrepo to without bringing any changes. - $ svn mkdir "$SVNREPOURL/unrelated" -m 'create unrelated' + $ svn mkdir "$SVNREPO/unrelated" -m 'create unrelated' Committed revision 4. - $ svn up -q s + $ svn up s + + Fetching external item into 's/externals' + External at revision 1. + + At revision 4. $ hg sum parent: 2:* tip (glob) Message! @@ -145,13 +150,20 @@ should be empty despite change to s/a add a commit from svn - $ cd "$WCROOT/src" - $ svn up -q + $ cd "$WCROOT"/src + $ svn up + U alpha + + Fetching external item into 'externals' + A externals/other + Updated external to revision 1. + + Updated to revision 4. $ echo xyz >> alpha $ svn propset svn:mime-type 'text/xml' alpha property 'svn:mime-type' set on 'alpha' $ svn ci -m 'amend a from svn' - Sending *alpha (glob) + Sending src/alpha Transmitting file data . Committed revision 5. $ cd ../../sub/t @@ -159,26 +171,28 @@ add a commit from svn this commit from hg will fail $ echo zzz >> s/alpha - $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' + $ hg ci -m 'amend alpha from hg' committing subrepository s - abort: svn:*Commit failed (details follow): (glob) + abort: svn: Commit failed (details follow): + svn: (Out of date)?.*/src/alpha.*(is out of date)? (re) [255] $ svn revert -q s/alpha this commit fails because of meta changes $ svn propset svn:mime-type 'text/html' s/alpha - property 'svn:mime-type' set on 's/alpha' (glob) - $ (hg ci --subrepos -m 'amend alpha from hg' 2>&1; echo "[$?]") | grep -vi 'out of date' + property 'svn:mime-type' set on 's/alpha' + $ hg ci -m 'amend alpha from hg' committing subrepository s - abort: svn:*Commit failed (details follow): (glob) + abort: svn: Commit failed (details follow): + svn: (Out of date)?.*/src/alpha.*(is out of date)? (re) [255] $ svn revert -q s/alpha this commit fails because of externals changes $ echo zzz > s/externals/other - $ hg ci --subrepos -m 'amend externals from hg' + $ hg ci -m 'amend externals from hg' committing subrepository s abort: cannot commit svn externals [255] @@ -199,8 +213,8 @@ this commit fails because of externals changes this commit fails because of externals meta changes $ svn propset svn:mime-type 'text/html' s/externals/other - property 'svn:mime-type' set on 's/externals/other' (glob) - $ hg ci --subrepos -m 'amend externals from hg' + property 'svn:mime-type' set on 's/externals/other' + $ hg ci -m 'amend externals from hg' committing subrepository s abort: cannot commit svn externals [255] @@ -209,21 +223,21 @@ this commit fails because of externals meta changes clone $ cd .. - $ hg clone t tc + $ hg clone t tc | fix_path updating to branch default - A tc/s/alpha (glob) - U tc/s (glob) + A tc/s/alpha + U tc/s - Fetching external item into 'tc/s/externals'* (glob) - A tc/s/externals/other (glob) + Fetching external item into 'tc/s/externals' + A tc/s/externals/other Checked out external at revision 1. Checked out revision 3. - A tc/subdir/s/alpha (glob) - U tc/subdir/s (glob) + A tc/subdir/s/alpha + U tc/subdir/s - Fetching external item into 'tc/subdir/s/externals'* (glob) - A tc/subdir/s/externals/other (glob) + Fetching external item into 'tc/subdir/s/externals' + A tc/subdir/s/externals/other Checked out external at revision 1. Checked out revision 2. @@ -252,39 +266,39 @@ update to nullrev (must delete the subrepo) $ ls Check hg update --clean - $ cd "$TESTTMP/sub/t" + $ cd $TESTTMP/sub/t $ cd s $ echo c0 > alpha $ echo c1 > f1 $ echo c1 > f2 $ svn add f1 -q - $ svn status | sort - + $ svn status ? * a (glob) + X * externals (glob) ? * f2 (glob) - A * f1 (glob) M * alpha (glob) - Performing status on external item at 'externals'* (glob) - X * externals (glob) + A * f1 (glob) + + Performing status on external item at 'externals' $ cd ../.. $ hg -R t update -C - Fetching external item into 't/s/externals'* (glob) + Fetching external item into 't/s/externals' Checked out external at revision 1. Checked out revision 3. 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd t/s - $ svn status | sort - + $ svn status ? * a (glob) + X * externals (glob) ? * f1 (glob) ? * f2 (glob) - Performing status on external item at 'externals'* (glob) - X * externals (glob) + + Performing status on external item at 'externals' Sticky subrepositories, no changes - $ cd "$TESTTMP/sub/t" + $ cd $TESTTMP/sub/t $ hg id -n 2 $ cd s @@ -292,9 +306,9 @@ Sticky subrepositories, no changes 3 $ cd .. $ hg update 1 - U *s/alpha (glob) + U $TESTTMP/sub/t/s/alpha - Fetching external item into '*s/externals'* (glob) + Fetching external item into '$TESTTMP/sub/t/s/externals' Checked out external at revision 1. Checked out revision 2. @@ -313,7 +327,7 @@ Sticky subrepositorys, file changes A f1 $ cd .. $ hg id -n - 1+ + 1 $ cd s $ svnversion 2M @@ -330,9 +344,9 @@ Sticky subrepositorys, file changes 2M $ cd .. $ hg update --clean tip - U *s/alpha (glob) + U $TESTTMP/sub/t/s/alpha - Fetching external item into '*s/externals'* (glob) + Fetching external item into '$TESTTMP/sub/t/s/externals' Checked out external at revision 1. Checked out revision 3. @@ -346,7 +360,14 @@ Sticky subrepository, revision updates 3 $ cd .. $ cd s - $ svn update -qr 1 + $ svn update -r 1 + U alpha + U . + + Fetching external item into 'externals' + Updated external to revision 1. + + Updated to revision 1. $ cd .. $ hg update 1 subrepository sources for s differ (in checked out version) @@ -376,18 +397,18 @@ Sticky subrepository, file changes and revision updates l 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg id -n - 2+ + 2 $ cd s $ svnversion 1M $ cd .. Sticky repository, update --clean - $ hg update --clean tip | grep -v 's[/\]externals[/\]other' - U *s/alpha (glob) - U *s (glob) + $ hg update --clean tip + U $TESTTMP/sub/t/s/alpha + U $TESTTMP/sub/t/s - Fetching external item into '*s/externals'* (glob) + Fetching external item into '$TESTTMP/sub/t/s/externals' Checked out external at revision 1. Checked out revision 3. @@ -401,7 +422,13 @@ Sticky repository, update --clean Test subrepo already at intended revision: $ cd s - $ svn update -qr 2 + $ svn update -r 2 + U alpha + + Fetching external item into 'externals' + Updated external to revision 1. + + Updated to revision 2. $ cd .. $ hg update 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -415,62 +442,75 @@ Test subrepo already at intended revision: Test case where subversion would fail to update the subrepo because there are unknown directories being replaced by tracked ones (happens with rebase). - $ cd "$WCROOT/src" + $ cd $WCROOT/src $ mkdir dir $ echo epsilon.py > dir/epsilon.py $ svn add dir A dir - A dir/epsilon.py (glob) + A dir/epsilon.py $ svn ci -m 'Add dir/epsilon.py' - Adding *dir (glob) - Adding *dir/epsilon.py (glob) + Adding src/dir + Adding src/dir/epsilon.py Transmitting file data . Committed revision 6. $ cd ../.. $ hg init rebaserepo $ cd rebaserepo - $ svn co -r5 --quiet "$SVNREPOURL"/src s - $ echo "s = [svn] $SVNREPOURL/src" >> .hgsub + $ svn co -r5 --quiet "$SVNREPO"/src s + $ echo "s = [svn] $SVNREPO/src" >> .hgsub $ hg add .hgsub $ hg ci -m addsub + committing subrepository s $ echo a > a $ hg ci -Am adda adding a $ hg up 0 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ svn up -qr6 s + $ svn up -r6 s + A s/dir + A s/dir/epsilon.py + + Fetching external item into 's/externals' + Updated external to revision 1. + + Updated to revision 6. $ hg ci -m updatesub + committing subrepository s created new head $ echo pyc > s/dir/epsilon.pyc $ hg up 1 - D *s/dir (glob) + D $TESTTMP/rebaserepo/s/dir - Fetching external item into '*s/externals'* (glob) + Fetching external item into '$TESTTMP/rebaserepo/s/externals' Checked out external at revision 1. Checked out revision 5. 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg up -q 2 + $ if "$TESTDIR/hghave" -q svn15; then + > hg up 2 >/dev/null 2>&1 || echo update failed + > fi Modify one of the externals to point to a different path so we can test having obstructions when switching branches on checkout: $ hg checkout tip 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo "obstruct = [svn] $SVNREPOURL/externals" >> .hgsub - $ svn co -r5 --quiet "$SVNREPOURL"/externals obstruct - $ hg commit -m 'Start making obstructed working copy' + $ echo "obstruct = [svn] $SVNREPO/externals" >> .hgsub + $ svn co -r5 --quiet "$SVNREPO"/externals obstruct + $ hg commit -m 'Start making obstructed wc' + committing subrepository obstruct $ hg book other $ hg co -r 'p1(tip)' 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ echo "obstruct = [svn] $SVNREPOURL/src" >> .hgsub - $ svn co -r5 --quiet "$SVNREPOURL"/src obstruct + $ echo "obstruct = [svn] $SVNREPO/src" >> .hgsub + $ svn co -r5 --quiet "$SVNREPO"/src obstruct $ hg commit -m 'Other branch which will be obstructed' + committing subrepository obstruct created new head Switching back to the head where we have another path mapped to the same subrepo should work if the subrepo is clean. $ hg co other - A *obstruct/other (glob) + A $TESTTMP/rebaserepo/obstruct/other Checked out revision 1. 2 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -483,19 +523,19 @@ This is surprising, but is also correct based on the current code: Point to a Subversion branch which has since been deleted and recreated First, create that condition in the repository. - $ hg ci --subrepos -m cleanup | grep -v Updating + $ hg ci -m cleanup committing subrepository obstruct - Sending obstruct/other (glob) + Sending obstruct/other Transmitting file data . Committed revision 7. At revision 7. - $ svn mkdir -m "baseline" $SVNREPOURL/trunk + $ svn mkdir -m "baseline" $SVNREPO/trunk Committed revision 8. - $ svn copy -m "initial branch" $SVNREPOURL/trunk $SVNREPOURL/branch + $ svn copy -m "initial branch" $SVNREPO/trunk $SVNREPO/branch Committed revision 9. - $ svn co --quiet "$SVNREPOURL"/branch tempwc + $ svn co --quiet "$SVNREPO"/branch tempwc $ cd tempwc $ echo "something old" > somethingold $ svn add somethingold @@ -504,13 +544,15 @@ First, create that condition in the repository. Adding somethingold Transmitting file data . Committed revision 10. - $ svn rm -m "remove branch" $SVNREPOURL/branch + $ svn rm -m "remove branch" $SVNREPO/branch Committed revision 11. - $ svn copy -m "recreate branch" $SVNREPOURL/trunk $SVNREPOURL/branch + $ svn copy -m "recreate branch" $SVNREPO/trunk $SVNREPO/branch Committed revision 12. - $ svn up -q + $ svn up + D somethingold + Updated to revision 12. $ echo "something new" > somethingnew $ svn add somethingnew A somethingnew @@ -520,106 +562,24 @@ First, create that condition in the repository. Committed revision 13. $ cd .. $ rm -rf tempwc - $ svn co "$SVNREPOURL/branch"@10 recreated - A recreated/somethingold (glob) + $ svn co "$SVNREPO/branch"@10 recreated + A recreated/somethingold Checked out revision 10. - $ echo "recreated = [svn] $SVNREPOURL/branch" >> .hgsub + $ echo "recreated = [svn] $SVNREPO/branch" >> .hgsub $ hg ci -m addsub + committing subrepository recreated $ cd recreated - $ svn up -q + $ svn up + D somethingold + A somethingnew + Updated to revision 13. $ cd .. $ hg ci -m updatesub + committing subrepository recreated $ hg up -r-2 - D *recreated/somethingnew (glob) - A *recreated/somethingold (glob) + D $TESTTMP/rebaserepo/recreated/somethingnew + A $TESTTMP/rebaserepo/recreated/somethingold Checked out revision 10. 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ test -f recreated/somethingold - -Test archive - - $ hg archive -S ../archive-all --debug - archiving: 0/2 files (0.00%) - archiving: .hgsub 1/2 files (50.00%) - archiving: .hgsubstate 2/2 files (100.00%) - archiving (obstruct): 0/1 files (0.00%) - archiving (obstruct): 1/1 files (100.00%) - archiving (s): 0/2 files (0.00%) - archiving (s): 1/2 files (50.00%) - archiving (s): 2/2 files (100.00%) - archiving (recreated): 0/1 files (0.00%) - archiving (recreated): 1/1 files (100.00%) - - $ hg archive -S ../archive-exclude --debug -X **old - archiving: 0/2 files (0.00%) - archiving: .hgsub 1/2 files (50.00%) - archiving: .hgsubstate 2/2 files (100.00%) - archiving (obstruct): 0/1 files (0.00%) - archiving (obstruct): 1/1 files (100.00%) - archiving (s): 0/2 files (0.00%) - archiving (s): 1/2 files (50.00%) - archiving (s): 2/2 files (100.00%) - archiving (recreated): 0 files - $ find ../archive-exclude | sort - ../archive-exclude - ../archive-exclude/.hg_archival.txt - ../archive-exclude/.hgsub - ../archive-exclude/.hgsubstate - ../archive-exclude/obstruct - ../archive-exclude/obstruct/other - ../archive-exclude/s - ../archive-exclude/s/alpha - ../archive-exclude/s/dir - ../archive-exclude/s/dir/epsilon.py - -Test forgetting files, not implemented in svn subrepo, used to -traceback - -#if no-windows - $ hg forget 'notafile*' - notafile*: No such file or directory - [1] -#else - $ hg forget 'notafile' - notafile: * (glob) - [1] -#endif - -Test a subrepo referencing a just moved svn path. Last commit rev will -be different from the revision, and the path will be different as -well. - - $ cd "$WCROOT" - $ svn up > /dev/null - $ mkdir trunk/subdir branches - $ echo a > trunk/subdir/a - $ svn add trunk/subdir branches - A trunk/subdir (glob) - A trunk/subdir/a (glob) - A branches - $ svn ci -m addsubdir - Adding branches - Adding trunk/subdir (glob) - Adding trunk/subdir/a (glob) - Transmitting file data . - Committed revision 14. - $ svn cp -m branchtrunk $SVNREPOURL/trunk $SVNREPOURL/branches/somebranch - - Committed revision 15. - $ cd .. + $ test -e recreated/somethingold - $ hg init repo2 - $ cd repo2 - $ svn co $SVNREPOURL/branches/somebranch/subdir - A subdir/a (glob) - Checked out revision 15. - $ echo "subdir = [svn] $SVNREPOURL/branches/somebranch/subdir" > .hgsub - $ hg add .hgsub - $ hg ci -m addsub - $ hg up null - 0 files updated, 0 files merged, 2 files removed, 0 files unresolved - $ hg up - A *subdir/a (glob) - Checked out revision 15. - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd .. |