comparison tests/test-rollback.t @ 12485:8fdc11fec6ae

tests: unify test-rollback
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Sep 2010 13:44:49 -0500
parents tests/test-rollback@4c94b6d0fb1c
children bb35840e965c
comparison
equal deleted inserted replaced
12484:59012130b43e 12485:8fdc11fec6ae
1
2 $ mkdir t
3 $ cd t
4 $ hg init
5 $ echo a > a
6 $ hg add a
7 $ hg commit -m "test"
8 $ hg verify
9 checking changesets
10 checking manifests
11 crosschecking files in changesets and manifests
12 checking files
13 1 files, 1 changesets, 1 total revisions
14 $ hg parents
15 changeset: 0:acb14030fe0a
16 tag: tip
17 user: test
18 date: Thu Jan 01 00:00:00 1970 +0000
19 summary: test
20
21 $ hg status
22 $ hg rollback
23 rolling back to revision -1 (undo commit)
24 $ hg verify
25 checking changesets
26 checking manifests
27 crosschecking files in changesets and manifests
28 checking files
29 0 files, 0 changesets, 0 total revisions
30 $ hg parents
31 $ hg status
32 A a
33
34 Test issue 902
35
36 $ hg commit -m "test2"
37 $ hg branch test
38 marked working directory as branch test
39 $ hg rollback
40 rolling back to revision -1 (undo commit)
41 $ hg branch
42 default
43
44 Test issue 1635 (commit message saved)
45 .hg/last-message.txt:
46
47 $ cat .hg/last-message.txt ; echo
48 test2
49
50 Test rollback of hg before issue 902 was fixed
51
52 $ hg commit -m "test3"
53 $ hg branch test
54 marked working directory as branch test
55 $ rm .hg/undo.branch
56 $ hg rollback
57 rolling back to revision -1 (undo commit)
58 Named branch could not be reset, current branch still is: test
59 $ hg branch
60 test
61
62 rollback by pretxncommit saves commit message (issue 1635)
63
64 $ echo a >> a
65 $ hg --config hooks.pretxncommit=false commit -m"precious commit message"
66 transaction abort!
67 rollback completed
68 abort: pretxncommit hook exited with status * (glob)
69 [255]
70
71 .hg/last-message.txt:
72
73 $ cat .hg/last-message.txt ; echo
74 precious commit message
75 $ echo '% same thing, but run $EDITOR'
76 % same thing, but run $EDITOR
77 $ cat > $HGTMP/editor <<'__EOF__'
78 > #!/bin/sh
79 > echo "another precious commit message" > "$1"
80 > __EOF__
81 > chmod +x "$HGTMP"/editor
82 > HGEDITOR="'$HGTMP'"/editor hg --config hooks.pretxncommit=false commit 2>&1
83 > cat .hg/last-message.txt
84 transaction abort!
85 rollback completed
86 note: commit message saved in .hg/last-message.txt
87 abort: pretxncommit hook exited with status * (glob)
88 another precious commit message
89
90 .hg/last-message.txt:
91