comparison tests/test-rollback.t @ 15108:4c1ec0fe59d6

test-rollback: tinker a bit to make it easier to add more tests.
author Greg Ward <greg@gerg.ca>
date Wed, 14 Sep 2011 22:01:39 -0400
parents 141f88ae5276
children 3d44e68360a6
comparison
equal deleted inserted replaced
15107:2433525a9e1e 15108:4c1ec0fe59d6
1 1 setup repo
2 $ hg init t 2 $ hg init t
3 $ cd t 3 $ cd t
4 $ echo a > a 4 $ echo a > a
5 $ hg add a 5 $ hg commit -Am'add a'
6 $ hg commit -m "test" 6 adding a
7 $ hg verify 7 $ hg verify
8 checking changesets 8 checking changesets
9 checking manifests 9 checking manifests
10 crosschecking files in changesets and manifests 10 crosschecking files in changesets and manifests
11 checking files 11 checking files
12 1 files, 1 changesets, 1 total revisions 12 1 files, 1 changesets, 1 total revisions
13 $ hg parents 13 $ hg parents
14 changeset: 0:acb14030fe0a 14 changeset: 0:1f0dee641bb7
15 tag: tip 15 tag: tip
16 user: test 16 user: test
17 date: Thu Jan 01 00:00:00 1970 +0000 17 date: Thu Jan 01 00:00:00 1970 +0000
18 summary: test 18 summary: add a
19 19
20
21 rollback to null revision
20 $ hg status 22 $ hg status
21 $ hg rollback 23 $ hg rollback
22 repository tip rolled back to revision -1 (undo commit) 24 repository tip rolled back to revision -1 (undo commit)
23 working directory now based on revision -1 25 working directory now based on revision -1
24 $ hg verify 26 $ hg verify
29 0 files, 0 changesets, 0 total revisions 31 0 files, 0 changesets, 0 total revisions
30 $ hg parents 32 $ hg parents
31 $ hg status 33 $ hg status
32 A a 34 A a
33 35
34 Test issue 902 36 Two changesets this time so we rollback to a real changeset
37 $ hg commit -m'add a again'
38 $ echo a >> a
39 $ hg commit -m'modify a'
35 40
36 $ hg commit -m "test2" 41 Test issue 902 (current branch is preserved)
37 $ hg branch test 42 $ hg branch test
38 marked working directory as branch test 43 marked working directory as branch test
39 $ hg rollback 44 $ hg rollback
40 repository tip rolled back to revision -1 (undo commit) 45 repository tip rolled back to revision 0 (undo commit)
41 working directory now based on revision -1 46 working directory now based on revision 0
42 $ hg branch 47 $ hg branch
43 default 48 default
44 49
45 Test issue 1635 (commit message saved) 50 Test issue 1635 (commit message saved)
46 .hg/last-message.txt:
47
48 $ cat .hg/last-message.txt ; echo 51 $ cat .hg/last-message.txt ; echo
49 test2 52 modify a
50 53
51 Test rollback of hg before issue 902 was fixed 54 Test rollback of hg before issue 902 was fixed
52 55
53 $ hg commit -m "test3" 56 $ hg commit -m "test3"
54 $ hg branch test 57 $ hg branch test
55 marked working directory as branch test 58 marked working directory as branch test
56 $ rm .hg/undo.branch 59 $ rm .hg/undo.branch
57 $ hg rollback 60 $ hg rollback
58 repository tip rolled back to revision -1 (undo commit) 61 repository tip rolled back to revision 0 (undo commit)
59 named branch could not be reset, current branch is still: test 62 named branch could not be reset, current branch is still: test
60 working directory now based on revision -1 63 working directory now based on revision 0
61 $ hg branch 64 $ hg branch
62 test 65 test
63 66
64 rollback by pretxncommit saves commit message (issue 1635) 67 rollback by pretxncommit saves commit message (issue 1635)
65 68
67 $ hg --config hooks.pretxncommit=false commit -m"precious commit message" 70 $ hg --config hooks.pretxncommit=false commit -m"precious commit message"
68 transaction abort! 71 transaction abort!
69 rollback completed 72 rollback completed
70 abort: pretxncommit hook exited with status * (glob) 73 abort: pretxncommit hook exited with status * (glob)
71 [255] 74 [255]
72
73 .hg/last-message.txt:
74
75 $ cat .hg/last-message.txt ; echo 75 $ cat .hg/last-message.txt ; echo
76 precious commit message 76 precious commit message
77 77
78 same thing, but run $EDITOR 78 same thing, but run $EDITOR
79 79
100 $ hg clone http://localhost:$HGPORT u 100 $ hg clone http://localhost:$HGPORT u
101 requesting all changes 101 requesting all changes
102 adding changesets 102 adding changesets
103 adding manifests 103 adding manifests
104 adding file changes 104 adding file changes
105 added 1 changesets with 1 changes to 1 files 105 added 2 changesets with 2 changes to 1 files
106 updating to branch test 106 updating to branch default
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 $ cd u 108 $ cd u
109 $ hg id default 109 $ hg id default
110 1df294f7b1a2 110 8902593132ae
111 111
112 now rollback and observe that 'hg serve' reloads the repository and 112 now rollback and observe that 'hg serve' reloads the repository and
113 presents the correct tip changeset: 113 presents the correct tip changeset:
114 114
115 $ hg -R ../t rollback 115 $ hg -R ../t rollback
116 repository tip rolled back to revision -1 (undo commit) 116 repository tip rolled back to revision 0 (undo commit)
117 working directory now based on revision -1 117 working directory now based on revision 0
118 $ hg id default 118 $ hg id default
119 000000000000 119 23b0221f3370