Show More
@@ -1,187 +1,187 b'' | |||||
1 | $ "$TESTDIR/hghave" serve || exit 80 |
|
|||
2 |
|
||||
3 | setup repo |
|
1 | setup repo | |
4 | $ hg init t |
|
2 | $ hg init t | |
5 | $ cd t |
|
3 | $ cd t | |
6 | $ echo a > a |
|
4 | $ echo a > a | |
7 | $ hg commit -Am'add a' |
|
5 | $ hg commit -Am'add a' | |
8 | adding a |
|
6 | adding a | |
9 | $ hg verify |
|
7 | $ hg verify | |
10 | checking changesets |
|
8 | checking changesets | |
11 | checking manifests |
|
9 | checking manifests | |
12 | crosschecking files in changesets and manifests |
|
10 | crosschecking files in changesets and manifests | |
13 | checking files |
|
11 | checking files | |
14 | 1 files, 1 changesets, 1 total revisions |
|
12 | 1 files, 1 changesets, 1 total revisions | |
15 | $ hg parents |
|
13 | $ hg parents | |
16 | changeset: 0:1f0dee641bb7 |
|
14 | changeset: 0:1f0dee641bb7 | |
17 | tag: tip |
|
15 | tag: tip | |
18 | user: test |
|
16 | user: test | |
19 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
17 | date: Thu Jan 01 00:00:00 1970 +0000 | |
20 | summary: add a |
|
18 | summary: add a | |
21 |
|
19 | |||
22 |
|
20 | |||
23 | rollback to null revision |
|
21 | rollback to null revision | |
24 | $ hg status |
|
22 | $ hg status | |
25 | $ hg rollback |
|
23 | $ hg rollback | |
26 | repository tip rolled back to revision -1 (undo commit) |
|
24 | repository tip rolled back to revision -1 (undo commit) | |
27 | working directory now based on revision -1 |
|
25 | working directory now based on revision -1 | |
28 | $ hg verify |
|
26 | $ hg verify | |
29 | checking changesets |
|
27 | checking changesets | |
30 | checking manifests |
|
28 | checking manifests | |
31 | crosschecking files in changesets and manifests |
|
29 | crosschecking files in changesets and manifests | |
32 | checking files |
|
30 | checking files | |
33 | 0 files, 0 changesets, 0 total revisions |
|
31 | 0 files, 0 changesets, 0 total revisions | |
34 | $ hg parents |
|
32 | $ hg parents | |
35 | $ hg status |
|
33 | $ hg status | |
36 | A a |
|
34 | A a | |
37 |
|
35 | |||
38 | Two changesets this time so we rollback to a real changeset |
|
36 | Two changesets this time so we rollback to a real changeset | |
39 | $ hg commit -m'add a again' |
|
37 | $ hg commit -m'add a again' | |
40 | $ echo a >> a |
|
38 | $ echo a >> a | |
41 | $ hg commit -m'modify a' |
|
39 | $ hg commit -m'modify a' | |
42 |
|
40 | |||
43 | Test issue 902 (current branch is preserved) |
|
41 | Test issue 902 (current branch is preserved) | |
44 | $ hg branch test |
|
42 | $ hg branch test | |
45 | marked working directory as branch test |
|
43 | marked working directory as branch test | |
46 | (branches are permanent and global, did you want a bookmark?) |
|
44 | (branches are permanent and global, did you want a bookmark?) | |
47 | $ hg rollback |
|
45 | $ hg rollback | |
48 | repository tip rolled back to revision 0 (undo commit) |
|
46 | repository tip rolled back to revision 0 (undo commit) | |
49 | working directory now based on revision 0 |
|
47 | working directory now based on revision 0 | |
50 | $ hg branch |
|
48 | $ hg branch | |
51 | default |
|
49 | default | |
52 |
|
50 | |||
53 | Test issue 1635 (commit message saved) |
|
51 | Test issue 1635 (commit message saved) | |
54 | $ cat .hg/last-message.txt ; echo |
|
52 | $ cat .hg/last-message.txt ; echo | |
55 | modify a |
|
53 | modify a | |
56 |
|
54 | |||
57 | Test rollback of hg before issue 902 was fixed |
|
55 | Test rollback of hg before issue 902 was fixed | |
58 |
|
56 | |||
59 | $ hg commit -m "test3" |
|
57 | $ hg commit -m "test3" | |
60 | $ hg branch test |
|
58 | $ hg branch test | |
61 | marked working directory as branch test |
|
59 | marked working directory as branch test | |
62 | (branches are permanent and global, did you want a bookmark?) |
|
60 | (branches are permanent and global, did you want a bookmark?) | |
63 | $ rm .hg/undo.branch |
|
61 | $ rm .hg/undo.branch | |
64 | $ hg rollback |
|
62 | $ hg rollback | |
65 | repository tip rolled back to revision 0 (undo commit) |
|
63 | repository tip rolled back to revision 0 (undo commit) | |
66 | named branch could not be reset: current branch is still 'test' |
|
64 | named branch could not be reset: current branch is still 'test' | |
67 | working directory now based on revision 0 |
|
65 | working directory now based on revision 0 | |
68 | $ hg branch |
|
66 | $ hg branch | |
69 | test |
|
67 | test | |
70 |
|
68 | |||
71 | working dir unaffected by rollback: do not restore dirstate et. al. |
|
69 | working dir unaffected by rollback: do not restore dirstate et. al. | |
72 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
70 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
73 | 0 default add a again |
|
71 | 0 default add a again | |
74 | $ hg status |
|
72 | $ hg status | |
75 | M a |
|
73 | M a | |
76 | $ hg bookmark foo |
|
74 | $ hg bookmark foo | |
77 | $ hg commit -m'modify a again' |
|
75 | $ hg commit -m'modify a again' | |
78 | $ echo b > b |
|
76 | $ echo b > b | |
79 | $ hg commit -Am'add b' |
|
77 | $ hg commit -Am'add b' | |
80 | adding b |
|
78 | adding b | |
81 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
79 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
82 | 2 test add b |
|
80 | 2 test add b | |
83 | 1 test modify a again |
|
81 | 1 test modify a again | |
84 | 0 default add a again |
|
82 | 0 default add a again | |
85 | $ hg update default |
|
83 | $ hg update default | |
86 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
84 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
87 | $ hg bookmark bar |
|
85 | $ hg bookmark bar | |
88 | $ cat .hg/undo.branch ; echo |
|
86 | $ cat .hg/undo.branch ; echo | |
89 | test |
|
87 | test | |
90 | $ hg rollback -f |
|
88 | $ hg rollback -f | |
91 | repository tip rolled back to revision 1 (undo commit) |
|
89 | repository tip rolled back to revision 1 (undo commit) | |
92 | $ hg id -n |
|
90 | $ hg id -n | |
93 | 0 |
|
91 | 0 | |
94 | $ hg branch |
|
92 | $ hg branch | |
95 | default |
|
93 | default | |
96 | $ cat .hg/bookmarks.current ; echo |
|
94 | $ cat .hg/bookmarks.current ; echo | |
97 | bar |
|
95 | bar | |
98 | $ hg bookmark --delete foo |
|
96 | $ hg bookmark --delete foo | |
99 |
|
97 | |||
100 | rollback by pretxncommit saves commit message (issue 1635) |
|
98 | rollback by pretxncommit saves commit message (issue 1635) | |
101 |
|
99 | |||
102 | $ echo a >> a |
|
100 | $ echo a >> a | |
103 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
|
101 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" | |
104 | transaction abort! |
|
102 | transaction abort! | |
105 | rollback completed |
|
103 | rollback completed | |
106 | abort: pretxncommit hook exited with status * (glob) |
|
104 | abort: pretxncommit hook exited with status * (glob) | |
107 | [255] |
|
105 | [255] | |
108 | $ cat .hg/last-message.txt ; echo |
|
106 | $ cat .hg/last-message.txt ; echo | |
109 | precious commit message |
|
107 | precious commit message | |
110 |
|
108 | |||
111 | same thing, but run $EDITOR |
|
109 | same thing, but run $EDITOR | |
112 |
|
110 | |||
113 | $ cat > editor.sh << '__EOF__' |
|
111 | $ cat > editor.sh << '__EOF__' | |
114 | > echo "another precious commit message" > "$1" |
|
112 | > echo "another precious commit message" > "$1" | |
115 | > __EOF__ |
|
113 | > __EOF__ | |
116 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 |
|
114 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 | |
117 | transaction abort! |
|
115 | transaction abort! | |
118 | rollback completed |
|
116 | rollback completed | |
119 | note: commit message saved in .hg/last-message.txt |
|
117 | note: commit message saved in .hg/last-message.txt | |
120 | abort: pretxncommit hook exited with status * (glob) |
|
118 | abort: pretxncommit hook exited with status * (glob) | |
121 | [255] |
|
119 | [255] | |
122 | $ cat .hg/last-message.txt |
|
120 | $ cat .hg/last-message.txt | |
123 | another precious commit message |
|
121 | another precious commit message | |
124 |
|
122 | |||
125 | test rollback on served repository |
|
123 | test rollback on served repository | |
126 |
|
124 | |||
|
125 | #if serve | |||
127 | $ hg commit -m "precious commit message" |
|
126 | $ hg commit -m "precious commit message" | |
128 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
127 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
129 | $ cat hg.pid >> $DAEMON_PIDS |
|
128 | $ cat hg.pid >> $DAEMON_PIDS | |
130 | $ cd .. |
|
129 | $ cd .. | |
131 | $ hg clone http://localhost:$HGPORT u |
|
130 | $ hg clone http://localhost:$HGPORT u | |
132 | requesting all changes |
|
131 | requesting all changes | |
133 | adding changesets |
|
132 | adding changesets | |
134 | adding manifests |
|
133 | adding manifests | |
135 | adding file changes |
|
134 | adding file changes | |
136 | added 3 changesets with 2 changes to 1 files (+1 heads) |
|
135 | added 3 changesets with 2 changes to 1 files (+1 heads) | |
137 | updating to branch default |
|
136 | updating to branch default | |
138 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
137 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
139 | $ cd u |
|
138 | $ cd u | |
140 | $ hg id default |
|
139 | $ hg id default | |
141 | 068774709090 |
|
140 | 068774709090 | |
142 |
|
141 | |||
143 | now rollback and observe that 'hg serve' reloads the repository and |
|
142 | now rollback and observe that 'hg serve' reloads the repository and | |
144 | presents the correct tip changeset: |
|
143 | presents the correct tip changeset: | |
145 |
|
144 | |||
146 | $ hg -R ../t rollback |
|
145 | $ hg -R ../t rollback | |
147 | repository tip rolled back to revision 1 (undo commit) |
|
146 | repository tip rolled back to revision 1 (undo commit) | |
148 | working directory now based on revision 0 |
|
147 | working directory now based on revision 0 | |
149 | $ hg id default |
|
148 | $ hg id default | |
150 | 791dd2169706 |
|
149 | 791dd2169706 | |
|
150 | #endif | |||
151 |
|
151 | |||
152 | update to older changeset and then refuse rollback, because |
|
152 | update to older changeset and then refuse rollback, because | |
153 | that would lose data (issue2998) |
|
153 | that would lose data (issue2998) | |
154 | $ cd ../t |
|
154 | $ cd ../t | |
155 | $ hg -q update |
|
155 | $ hg -q update | |
156 | $ rm `hg status -un` |
|
156 | $ rm `hg status -un` | |
157 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' |
|
157 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' | |
158 | $ echo 'valuable new file' > b |
|
158 | $ echo 'valuable new file' > b | |
159 | $ echo 'valuable modification' >> a |
|
159 | $ echo 'valuable modification' >> a | |
160 | $ hg commit -A -m'a valuable change' |
|
160 | $ hg commit -A -m'a valuable change' | |
161 | adding b |
|
161 | adding b | |
162 | $ hg update 0 |
|
162 | $ hg update 0 | |
163 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
163 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
164 | $ hg rollback |
|
164 | $ hg rollback | |
165 | abort: rollback of last commit while not checked out may lose data |
|
165 | abort: rollback of last commit while not checked out may lose data | |
166 | (use -f to force) |
|
166 | (use -f to force) | |
167 | [255] |
|
167 | [255] | |
168 | $ hg tip -q |
|
168 | $ hg tip -q | |
169 | 2:4d9cd3795eea |
|
169 | 2:4d9cd3795eea | |
170 | $ hg rollback -f |
|
170 | $ hg rollback -f | |
171 | repository tip rolled back to revision 1 (undo commit) |
|
171 | repository tip rolled back to revision 1 (undo commit) | |
172 | $ hg status |
|
172 | $ hg status | |
173 | $ hg log --removed b # yep, it's gone |
|
173 | $ hg log --removed b # yep, it's gone | |
174 |
|
174 | |||
175 | same again, but emulate an old client that doesn't write undo.desc |
|
175 | same again, but emulate an old client that doesn't write undo.desc | |
176 | $ hg -q update |
|
176 | $ hg -q update | |
177 | $ echo 'valuable modification redux' >> a |
|
177 | $ echo 'valuable modification redux' >> a | |
178 | $ hg commit -m'a valuable change redux' |
|
178 | $ hg commit -m'a valuable change redux' | |
179 | $ rm .hg/undo.desc |
|
179 | $ rm .hg/undo.desc | |
180 | $ hg update 0 |
|
180 | $ hg update 0 | |
181 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
181 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
182 | $ hg rollback |
|
182 | $ hg rollback | |
183 | rolling back unknown transaction |
|
183 | rolling back unknown transaction | |
184 | $ cat a |
|
184 | $ cat a | |
185 | a |
|
185 | a | |
186 |
|
186 | |||
187 | $ cd .. |
|
187 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now