Mercurial > hg
changeset 12485:8fdc11fec6ae
tests: unify test-rollback
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Sep 2010 13:44:49 -0500 |
parents | 59012130b43e |
children | 95b4af4eaa06 |
files | tests/test-rollback tests/test-rollback.out tests/test-rollback.t |
diffstat | 3 files changed, 91 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/test-rollback Sun Sep 26 13:44:49 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -#!/bin/sh - -mkdir t -cd t -hg init -echo a > a -hg add a -hg commit -m "test" -hg verify -hg parents -hg status -hg rollback -hg verify -hg parents -hg status - -echo % Test issue 902 -hg commit -m "test2" -hg branch test -hg rollback -hg branch - -echo '% Test issue 1635 (commit message saved)' -echo '.hg/last-message.txt:' -cat .hg/last-message.txt ; echo - -echo % Test rollback of hg before issue 902 was fixed -hg commit -m "test3" -hg branch test -rm .hg/undo.branch -hg rollback -hg branch - -echo '% rollback by pretxncommit saves commit message (issue 1635)' -echo a >> a -hg --config hooks.pretxncommit=false commit -m"precious commit message" 2>&1 | sed 's,exited with status .*,exited ...,g' -echo '.hg/last-message.txt:' -cat .hg/last-message.txt ; echo - -echo '% same thing, but run $EDITOR' -cat > $HGTMP/editor <<'__EOF__' -#!/bin/sh -echo "another precious commit message" > "$1" -__EOF__ -chmod +x "$HGTMP"/editor -HGEDITOR="'$HGTMP'"/editor hg --config hooks.pretxncommit=false commit 2>&1 | sed 's,exited with status .*,exited ...,g' -echo '.hg/last-message.txt:' -cat .hg/last-message.txt
--- a/tests/test-rollback.out Sun Sep 26 13:44:49 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -1 files, 1 changesets, 1 total revisions -changeset: 0:acb14030fe0a -tag: tip -user: test -date: Thu Jan 01 00:00:00 1970 +0000 -summary: test - -rolling back to revision -1 (undo commit) -checking changesets -checking manifests -crosschecking files in changesets and manifests -checking files -0 files, 0 changesets, 0 total revisions -A a -% Test issue 902 -marked working directory as branch test -rolling back to revision -1 (undo commit) -default -% Test issue 1635 (commit message saved) -.hg/last-message.txt: -test2 -% Test rollback of hg before issue 902 was fixed -marked working directory as branch test -rolling back to revision -1 (undo commit) -Named branch could not be reset, current branch still is: test -test -% rollback by pretxncommit saves commit message (issue 1635) -transaction abort! -rollback completed -abort: pretxncommit hook exited ... -.hg/last-message.txt: -precious commit message -% same thing, but run $EDITOR -transaction abort! -rollback completed -note: commit message saved in .hg/last-message.txt -abort: pretxncommit hook exited ... -.hg/last-message.txt: -another precious commit message
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rollback.t Sun Sep 26 13:44:49 2010 -0500 @@ -0,0 +1,91 @@ + + $ mkdir t + $ cd t + $ hg init + $ echo a > a + $ hg add a + $ hg commit -m "test" + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 1 files, 1 changesets, 1 total revisions + $ hg parents + changeset: 0:acb14030fe0a + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: test + + $ hg status + $ hg rollback + rolling back to revision -1 (undo commit) + $ hg verify + checking changesets + checking manifests + crosschecking files in changesets and manifests + checking files + 0 files, 0 changesets, 0 total revisions + $ hg parents + $ hg status + A a + +Test issue 902 + + $ hg commit -m "test2" + $ hg branch test + marked working directory as branch test + $ hg rollback + rolling back to revision -1 (undo commit) + $ hg branch + default + +Test issue 1635 (commit message saved) +.hg/last-message.txt: + + $ cat .hg/last-message.txt ; echo + test2 + +Test rollback of hg before issue 902 was fixed + + $ hg commit -m "test3" + $ hg branch test + marked working directory as branch test + $ rm .hg/undo.branch + $ hg rollback + rolling back to revision -1 (undo commit) + Named branch could not be reset, current branch still is: test + $ hg branch + test + +rollback by pretxncommit saves commit message (issue 1635) + + $ echo a >> a + $ hg --config hooks.pretxncommit=false commit -m"precious commit message" + transaction abort! + rollback completed + abort: pretxncommit hook exited with status * (glob) + [255] + +.hg/last-message.txt: + + $ cat .hg/last-message.txt ; echo + precious commit message + $ echo '% same thing, but run $EDITOR' + % same thing, but run $EDITOR + $ cat > $HGTMP/editor <<'__EOF__' + > #!/bin/sh + > echo "another precious commit message" > "$1" + > __EOF__ + > chmod +x "$HGTMP"/editor + > HGEDITOR="'$HGTMP'"/editor hg --config hooks.pretxncommit=false commit 2>&1 + > cat .hg/last-message.txt + transaction abort! + rollback completed + note: commit message saved in .hg/last-message.txt + abort: pretxncommit hook exited with status * (glob) + another precious commit message + +.hg/last-message.txt: +