# HG changeset patch # User Martin Geisler # Date 2010-08-14 01:26:03 # Node ID 0a0b2872b0dec882673f07c341102fc15a340066 # Parent bc436a97038bcd5f641d5f8beb1fcec4286b444d tests: unify test-bundle-vs-outgoing diff --git a/tests/test-bundle-vs-outgoing.out b/tests/test-bundle-vs-outgoing.out deleted file mode 100644 --- a/tests/test-bundle-vs-outgoing.out +++ /dev/null @@ -1,53 +0,0 @@ -% setup test repo1 -adding foo.txt -rev 1 -rev 2 -rev 3 -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -rev 4 -rev 5 -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 1 files merged, 0 files removed, 0 files unresolved -(branch merge, don't forget to commit) -rev 7 -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -rev 8 -% the story so far -@ 8 -| -| o 7 -| | -| o 6 -|/| -o | 5 -| | -o | 4 -| | -| o 3 -| | -| o 2 -|/ -o 1 -| -o 0 - -% sanity check of outgoing: expect revs 4 5 6 7 8 -requesting all changes -adding changesets -adding manifests -adding file changes -added 4 changesets with 4 changes to 1 files -updating to branch default -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -comparing with ../repo2 -searching for changes -4 -5 -6 -7 -8 -% test bundle (destination repo): expect 5 revisions -searching for changes -5 changesets found -% test bundle (base revision): expect 5 revisions -5 changesets found diff --git a/tests/test-bundle-vs-outgoing b/tests/test-bundle-vs-outgoing.t old mode 100755 new mode 100644 rename from tests/test-bundle-vs-outgoing rename to tests/test-bundle-vs-outgoing.t --- a/tests/test-bundle-vs-outgoing +++ b/tests/test-bundle-vs-outgoing.t @@ -1,84 +1,147 @@ -#!/bin/sh +this structure seems to tickle a bug in bundle's search for +changesets, so first we have to recreate it + +o 8 +| +| o 7 +| | +| o 6 +|/| +o | 5 +| | +o | 4 +| | +| o 3 +| | +| o 2 +|/ +o 1 +| +o 0 + + $ mkrev() + > { + > revno=$1 + > echo "rev $revno" + > echo "rev $revno" > foo.txt + > hg -q ci -m"rev $revno" + > } + + $ set -e + +setup test repo1 -# this structure seems to tickle a bug in bundle's search for -# changesets, so first we have to recreate it -# -# o 8 -# | -# | o 7 -# | | -# | o 6 -# |/| -# o | 5 -# | | -# o | 4 -# | | -# | o 3 -# | | -# | o 2 -# |/ -# o 1 -# | -# o 0 + $ hg init repo1 + $ cd repo1 + $ echo "rev 0" > foo.txt + $ hg ci -Am"rev 0" + adding foo.txt + $ mkrev 1 + rev 1 + +first branch + + $ mkrev 2 + rev 2 + $ mkrev 3 + rev 3 + +back to rev 1 to create second branch -mkrev() -{ - revno=$1 - echo "rev $revno" - echo "rev $revno" > foo.txt - hg -q ci -m"rev $revno" -} + $ hg up -r1 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkrev 4 + rev 4 + $ mkrev 5 + rev 5 + +merge first branch to second branch -set -e -echo "% setup test repo1" -hg init repo1 -cd repo1 -echo "rev 0" > foo.txt -hg ci -Am"rev 0" -mkrev 1 + $ hg up -C -r5 + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ HGMERGE=internal:local hg merge + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved + (branch merge, don't forget to commit) + $ echo "merge rev 5, rev 3" > foo.txt + $ hg ci -m"merge first branch to second branch" + +one more commit following the merge + + $ mkrev 7 + rev 7 + +back to "second branch" to make another head -# first branch -mkrev 2 -mkrev 3 + $ hg up -r5 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ mkrev 8 + rev 8 -# back to rev 1 to create second branch -hg up -r1 -mkrev 4 -mkrev 5 + $ echo "[extensions]" >> $HGRCPATH + $ echo "graphlog=" >> $HGRCPATH + +the story so far -# merge first branch to second branch -hg up -C -r5 -HGMERGE=internal:local hg merge -echo "merge rev 5, rev 3" > foo.txt -hg ci -m"merge first branch to second branch" + $ hg glog --template "{rev}\n" + @ 8 + | + | o 7 + | | + | o 6 + |/| + o | 5 + | | + o | 4 + | | + | o 3 + | | + | o 2 + |/ + o 1 + | + o 0 + -# one more commit following the merge -mkrev 7 +check that "hg outgoing" really does the right thing -# back to "second branch" to make another head -hg up -r5 -mkrev 8 +sanity check of outgoing: expect revs 4 5 6 7 8 -echo "[extensions]" >> $HGRCPATH -echo "graphlog=" >> $HGRCPATH - -echo "% the story so far" -hg glog --template "{rev}\n" + $ hg clone -r3 . ../repo2 + requesting all changes + adding changesets + adding manifests + adding file changes + added 4 changesets with 4 changes to 1 files + updating to branch default + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved -# check that "hg outgoing" really does the right thing -echo "% sanity check of outgoing: expect revs 4 5 6 7 8" -hg clone -r3 . ../repo2 -# this should (and does) report 5 outgoing revisions: 4 5 6 7 8 -hg outgoing --template "{rev}\n" ../repo2 +this should (and does) report 5 outgoing revisions: 4 5 6 7 8 + + $ hg outgoing --template "{rev}\n" ../repo2 + comparing with ../repo2 + searching for changes + 4 + 5 + 6 + 7 + 8 -echo "% test bundle (destination repo): expect 5 revisions" -# this should bundle the same 5 revisions that outgoing reported, but it -# actually bundles 7 -hg bundle foo.bundle ../repo2 +test bundle (destination repo): expect 5 revisions + +this should bundle the same 5 revisions that outgoing reported, but it + +actually bundles 7 + + $ hg bundle foo.bundle ../repo2 + searching for changes + 5 changesets found -echo "% test bundle (base revision): expect 5 revisions" -# this should (and does) give exactly the same result as bundle -# with a destination repo... i.e. it's wrong too -hg bundle --base 3 foo.bundle +test bundle (base revision): expect 5 revisions + +this should (and does) give exactly the same result as bundle +with a destination repo... i.e. it's wrong too + $ hg bundle --base 3 foo.bundle + 5 changesets found +