Show More
@@ -1,212 +1,485 b'' | |||||
1 | setup repo |
|
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 commit -Am'add a' |
|
5 | $ hg commit -Am'add a' | |
6 | adding a |
|
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:1f0dee641bb7 |
|
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: add a |
|
18 | summary: add a | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | rollback to null revision |
|
21 | rollback to null revision | |
22 | $ hg status |
|
22 | $ hg status | |
23 | $ hg rollback |
|
23 | $ hg rollback | |
24 | repository tip rolled back to revision -1 (undo commit) |
|
24 | repository tip rolled back to revision -1 (undo commit) | |
25 | working directory now based on revision -1 |
|
25 | working directory now based on revision -1 | |
26 | $ hg verify |
|
26 | $ hg verify | |
27 | checking changesets |
|
27 | checking changesets | |
28 | checking manifests |
|
28 | checking manifests | |
29 | crosschecking files in changesets and manifests |
|
29 | crosschecking files in changesets and manifests | |
30 | checking files |
|
30 | checking files | |
31 | 0 files, 0 changesets, 0 total revisions |
|
31 | 0 files, 0 changesets, 0 total revisions | |
32 | $ hg parents |
|
32 | $ hg parents | |
33 | $ hg status |
|
33 | $ hg status | |
34 | A a |
|
34 | A a | |
35 |
|
35 | |||
36 | Two changesets this time so we rollback to a real changeset |
|
36 | Two changesets this time so we rollback to a real changeset | |
37 | $ hg commit -m'add a again' |
|
37 | $ hg commit -m'add a again' | |
38 | $ echo a >> a |
|
38 | $ echo a >> a | |
39 | $ hg commit -m'modify a' |
|
39 | $ hg commit -m'modify a' | |
40 |
|
40 | |||
41 | Test issue 902 (current branch is preserved) |
|
41 | Test issue 902 (current branch is preserved) | |
42 | $ hg branch test |
|
42 | $ hg branch test | |
43 | marked working directory as branch test |
|
43 | marked working directory as branch test | |
44 | (branches are permanent and global, did you want a bookmark?) |
|
44 | (branches are permanent and global, did you want a bookmark?) | |
45 | $ hg rollback |
|
45 | $ hg rollback | |
46 | repository tip rolled back to revision 0 (undo commit) |
|
46 | repository tip rolled back to revision 0 (undo commit) | |
47 | working directory now based on revision 0 |
|
47 | working directory now based on revision 0 | |
48 | $ hg branch |
|
48 | $ hg branch | |
49 | default |
|
49 | default | |
50 |
|
50 | |||
51 | Test issue 1635 (commit message saved) |
|
51 | Test issue 1635 (commit message saved) | |
52 | $ cat .hg/last-message.txt ; echo |
|
52 | $ cat .hg/last-message.txt ; echo | |
53 | modify a |
|
53 | modify a | |
54 |
|
54 | |||
55 | Test rollback of hg before issue 902 was fixed |
|
55 | Test rollback of hg before issue 902 was fixed | |
56 |
|
56 | |||
57 | $ hg commit -m "test3" |
|
57 | $ hg commit -m "test3" | |
58 | $ hg branch test |
|
58 | $ hg branch test | |
59 | marked working directory as branch test |
|
59 | marked working directory as branch test | |
60 | (branches are permanent and global, did you want a bookmark?) |
|
60 | (branches are permanent and global, did you want a bookmark?) | |
61 | $ rm .hg/undo.branch |
|
61 | $ rm .hg/undo.branch | |
62 | $ hg rollback |
|
62 | $ hg rollback | |
63 | repository tip rolled back to revision 0 (undo commit) |
|
63 | repository tip rolled back to revision 0 (undo commit) | |
64 | named branch could not be reset: current branch is still 'test' |
|
64 | named branch could not be reset: current branch is still 'test' | |
65 | working directory now based on revision 0 |
|
65 | working directory now based on revision 0 | |
66 | $ hg branch |
|
66 | $ hg branch | |
67 | test |
|
67 | test | |
68 |
|
68 | |||
69 | working dir unaffected by rollback: do not restore dirstate et. al. |
|
69 | working dir unaffected by rollback: do not restore dirstate et. al. | |
70 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
70 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
71 | 0 default add a again |
|
71 | 0 default add a again | |
72 | $ hg status |
|
72 | $ hg status | |
73 | M a |
|
73 | M a | |
74 | $ hg bookmark foo |
|
74 | $ hg bookmark foo | |
75 | $ hg commit -m'modify a again' |
|
75 | $ hg commit -m'modify a again' | |
76 | $ echo b > b |
|
76 | $ echo b > b | |
77 | $ hg bookmark bar -r default #making bar active, before the transaction |
|
77 | $ hg bookmark bar -r default #making bar active, before the transaction | |
78 | $ hg commit -Am'add b' |
|
78 | $ hg commit -Am'add b' | |
79 | adding b |
|
79 | adding b | |
80 | $ hg log --template '{rev} {branch} {desc|firstline}\n' |
|
80 | $ hg log --template '{rev} {branch} {desc|firstline}\n' | |
81 | 2 test add b |
|
81 | 2 test add b | |
82 | 1 test modify a again |
|
82 | 1 test modify a again | |
83 | 0 default add a again |
|
83 | 0 default add a again | |
84 | $ hg update bar |
|
84 | $ hg update bar | |
85 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
85 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
86 | (activating bookmark bar) |
|
86 | (activating bookmark bar) | |
87 | $ cat .hg/undo.branch ; echo |
|
87 | $ cat .hg/undo.branch ; echo | |
88 | test |
|
88 | test | |
89 | $ hg rollback -f |
|
89 | $ hg rollback -f | |
90 | repository tip rolled back to revision 1 (undo commit) |
|
90 | repository tip rolled back to revision 1 (undo commit) | |
91 | $ hg id -n |
|
91 | $ hg id -n | |
92 | 0 |
|
92 | 0 | |
93 | $ hg branch |
|
93 | $ hg branch | |
94 | default |
|
94 | default | |
95 | $ cat .hg/bookmarks.current ; echo |
|
95 | $ cat .hg/bookmarks.current ; echo | |
96 | bar |
|
96 | bar | |
97 | $ hg bookmark --delete foo bar |
|
97 | $ hg bookmark --delete foo bar | |
98 |
|
98 | |||
99 | rollback by pretxncommit saves commit message (issue1635) |
|
99 | rollback by pretxncommit saves commit message (issue1635) | |
100 |
|
100 | |||
101 | $ echo a >> a |
|
101 | $ echo a >> a | |
102 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" |
|
102 | $ hg --config hooks.pretxncommit=false commit -m"precious commit message" | |
103 | transaction abort! |
|
103 | transaction abort! | |
104 | rollback completed |
|
104 | rollback completed | |
105 | abort: pretxncommit hook exited with status * (glob) |
|
105 | abort: pretxncommit hook exited with status * (glob) | |
106 | [255] |
|
106 | [255] | |
107 | $ cat .hg/last-message.txt ; echo |
|
107 | $ cat .hg/last-message.txt ; echo | |
108 | precious commit message |
|
108 | precious commit message | |
109 |
|
109 | |||
110 | same thing, but run $EDITOR |
|
110 | same thing, but run $EDITOR | |
111 |
|
111 | |||
112 | $ cat > editor.sh << '__EOF__' |
|
112 | $ cat > editor.sh << '__EOF__' | |
113 | > echo "another precious commit message" > "$1" |
|
113 | > echo "another precious commit message" > "$1" | |
114 | > __EOF__ |
|
114 | > __EOF__ | |
115 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 |
|
115 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 | |
116 | note: commit message saved in .hg/last-message.txt |
|
116 | note: commit message saved in .hg/last-message.txt | |
117 | transaction abort! |
|
117 | transaction abort! | |
118 | rollback completed |
|
118 | rollback completed | |
119 | abort: pretxncommit hook exited with status * (glob) |
|
119 | abort: pretxncommit hook exited with status * (glob) | |
120 | [255] |
|
120 | [255] | |
121 | $ cat .hg/last-message.txt |
|
121 | $ cat .hg/last-message.txt | |
122 | another precious commit message |
|
122 | another precious commit message | |
123 |
|
123 | |||
124 | test rollback on served repository |
|
124 | test rollback on served repository | |
125 |
|
125 | |||
126 | #if serve |
|
126 | #if serve | |
127 | $ hg commit -m "precious commit message" |
|
127 | $ hg commit -m "precious commit message" | |
128 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
128 | $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log | |
129 | $ cat hg.pid >> $DAEMON_PIDS |
|
129 | $ cat hg.pid >> $DAEMON_PIDS | |
130 | $ cd .. |
|
130 | $ cd .. | |
131 | $ hg clone http://localhost:$HGPORT u |
|
131 | $ hg clone http://localhost:$HGPORT u | |
132 | requesting all changes |
|
132 | requesting all changes | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 3 changesets with 2 changes to 1 files (+1 heads) |
|
136 | added 3 changesets with 2 changes to 1 files (+1 heads) | |
137 | updating to branch default |
|
137 | updating to branch default | |
138 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
138 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
139 | $ cd u |
|
139 | $ cd u | |
140 | $ hg id default |
|
140 | $ hg id default | |
141 | 068774709090 |
|
141 | 068774709090 | |
142 |
|
142 | |||
143 | now rollback and observe that 'hg serve' reloads the repository and |
|
143 | now rollback and observe that 'hg serve' reloads the repository and | |
144 | presents the correct tip changeset: |
|
144 | presents the correct tip changeset: | |
145 |
|
145 | |||
146 | $ hg -R ../t rollback |
|
146 | $ hg -R ../t rollback | |
147 | repository tip rolled back to revision 1 (undo commit) |
|
147 | repository tip rolled back to revision 1 (undo commit) | |
148 | working directory now based on revision 0 |
|
148 | working directory now based on revision 0 | |
149 | $ hg id default |
|
149 | $ hg id default | |
150 | 791dd2169706 |
|
150 | 791dd2169706 | |
151 |
|
151 | |||
152 | $ killdaemons.py |
|
152 | $ killdaemons.py | |
153 | #endif |
|
153 | #endif | |
154 |
|
154 | |||
155 | update to older changeset and then refuse rollback, because |
|
155 | update to older changeset and then refuse rollback, because | |
156 | that would lose data (issue2998) |
|
156 | that would lose data (issue2998) | |
157 | $ cd ../t |
|
157 | $ cd ../t | |
158 | $ hg -q update |
|
158 | $ hg -q update | |
159 | $ rm `hg status -un` |
|
159 | $ rm `hg status -un` | |
160 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' |
|
160 | $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n' | |
161 | $ echo 'valuable new file' > b |
|
161 | $ echo 'valuable new file' > b | |
162 | $ echo 'valuable modification' >> a |
|
162 | $ echo 'valuable modification' >> a | |
163 | $ hg commit -A -m'a valuable change' |
|
163 | $ hg commit -A -m'a valuable change' | |
164 | adding b |
|
164 | adding b | |
165 | $ hg update 0 |
|
165 | $ hg update 0 | |
166 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
166 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
167 | $ hg rollback |
|
167 | $ hg rollback | |
168 | abort: rollback of last commit while not checked out may lose data |
|
168 | abort: rollback of last commit while not checked out may lose data | |
169 | (use -f to force) |
|
169 | (use -f to force) | |
170 | [255] |
|
170 | [255] | |
171 | $ hg tip -q |
|
171 | $ hg tip -q | |
172 | 2:4d9cd3795eea |
|
172 | 2:4d9cd3795eea | |
173 | $ hg rollback -f |
|
173 | $ hg rollback -f | |
174 | repository tip rolled back to revision 1 (undo commit) |
|
174 | repository tip rolled back to revision 1 (undo commit) | |
175 | $ hg status |
|
175 | $ hg status | |
176 | $ hg log --removed b # yep, it's gone |
|
176 | $ hg log --removed b # yep, it's gone | |
177 |
|
177 | |||
178 | same again, but emulate an old client that doesn't write undo.desc |
|
178 | same again, but emulate an old client that doesn't write undo.desc | |
179 | $ hg -q update |
|
179 | $ hg -q update | |
180 | $ echo 'valuable modification redux' >> a |
|
180 | $ echo 'valuable modification redux' >> a | |
181 | $ hg commit -m'a valuable change redux' |
|
181 | $ hg commit -m'a valuable change redux' | |
182 | $ rm .hg/undo.desc |
|
182 | $ rm .hg/undo.desc | |
183 | $ hg update 0 |
|
183 | $ hg update 0 | |
184 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
184 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
185 | $ hg rollback |
|
185 | $ hg rollback | |
186 | rolling back unknown transaction |
|
186 | rolling back unknown transaction | |
187 | $ cat a |
|
187 | $ cat a | |
188 | a |
|
188 | a | |
189 |
|
189 | |||
190 | corrupt journal test |
|
190 | corrupt journal test | |
191 | $ echo "foo" > .hg/store/journal |
|
191 | $ echo "foo" > .hg/store/journal | |
192 | $ hg recover |
|
192 | $ hg recover | |
193 | rolling back interrupted transaction |
|
193 | rolling back interrupted transaction | |
194 | couldn't read journal entry 'foo\n'! |
|
194 | couldn't read journal entry 'foo\n'! | |
195 | checking changesets |
|
195 | checking changesets | |
196 | checking manifests |
|
196 | checking manifests | |
197 | crosschecking files in changesets and manifests |
|
197 | crosschecking files in changesets and manifests | |
198 | checking files |
|
198 | checking files | |
199 | 1 files, 2 changesets, 2 total revisions |
|
199 | 1 files, 2 changesets, 2 total revisions | |
200 |
|
200 | |||
201 | rollback disabled by config |
|
201 | rollback disabled by config | |
202 | $ cat >> $HGRCPATH <<EOF |
|
202 | $ cat >> $HGRCPATH <<EOF | |
203 | > [ui] |
|
203 | > [ui] | |
204 | > rollback = false |
|
204 | > rollback = false | |
205 | > EOF |
|
205 | > EOF | |
206 | $ echo narf >> pinky-sayings.txt |
|
206 | $ echo narf >> pinky-sayings.txt | |
207 | $ hg add pinky-sayings.txt |
|
207 | $ hg add pinky-sayings.txt | |
208 | $ hg ci -m 'First one.' |
|
208 | $ hg ci -m 'First one.' | |
209 | $ hg rollback |
|
209 | $ hg rollback | |
210 | abort: rollback is disabled because it is unsafe |
|
210 | abort: rollback is disabled because it is unsafe | |
211 | (see `hg help -v rollback` for information) |
|
211 | (see `hg help -v rollback` for information) | |
212 | [255] |
|
212 | [255] | |
|
213 | ||||
|
214 | $ cd .. | |||
|
215 | ||||
|
216 | I/O errors on stdio are handled properly (issue5658) | |||
|
217 | ||||
|
218 | $ cat > badui.py << EOF | |||
|
219 | > import errno | |||
|
220 | > from mercurial.i18n import _ | |||
|
221 | > from mercurial import ( | |||
|
222 | > error, | |||
|
223 | > ui as uimod, | |||
|
224 | > ) | |||
|
225 | > | |||
|
226 | > def pretxncommit(ui, repo, **kwargs): | |||
|
227 | > ui.warn('warn during pretxncommit\n') | |||
|
228 | > | |||
|
229 | > def pretxnclose(ui, repo, **kwargs): | |||
|
230 | > ui.warn('warn during pretxnclose\n') | |||
|
231 | > | |||
|
232 | > def txnclose(ui, repo, **kwargs): | |||
|
233 | > ui.warn('warn during txnclose\n') | |||
|
234 | > | |||
|
235 | > def txnabort(ui, repo, **kwargs): | |||
|
236 | > ui.warn('warn during abort\n') | |||
|
237 | > | |||
|
238 | > class fdproxy(object): | |||
|
239 | > def __init__(self, ui, o): | |||
|
240 | > self._ui = ui | |||
|
241 | > self._o = o | |||
|
242 | > | |||
|
243 | > def __getattr__(self, attr): | |||
|
244 | > return getattr(self._o, attr) | |||
|
245 | > | |||
|
246 | > def write(self, msg): | |||
|
247 | > errors = set(self._ui.configlist('ui', 'ioerrors', [])) | |||
|
248 | > pretxncommit = msg == 'warn during pretxncommit\n' | |||
|
249 | > pretxnclose = msg == 'warn during pretxnclose\n' | |||
|
250 | > txnclose = msg == 'warn during txnclose\n' | |||
|
251 | > txnabort = msg == 'warn during abort\n' | |||
|
252 | > msgabort = msg == _('transaction abort!\n') | |||
|
253 | > msgrollback = msg == _('rollback completed\n') | |||
|
254 | > | |||
|
255 | > if pretxncommit and 'pretxncommit' in errors: | |||
|
256 | > raise IOError(errno.EPIPE, 'simulated epipe') | |||
|
257 | > if pretxnclose and 'pretxnclose' in errors: | |||
|
258 | > raise IOError(errno.EIO, 'simulated eio') | |||
|
259 | > if txnclose and 'txnclose' in errors: | |||
|
260 | > raise IOError(errno.EBADF, 'simulated badf') | |||
|
261 | > if txnabort and 'txnabort' in errors: | |||
|
262 | > raise IOError(errno.EPIPE, 'simulated epipe') | |||
|
263 | > if msgabort and 'msgabort' in errors: | |||
|
264 | > raise IOError(errno.EBADF, 'simulated ebadf') | |||
|
265 | > if msgrollback and 'msgrollback' in errors: | |||
|
266 | > raise IOError(errno.EIO, 'simulated eio') | |||
|
267 | > | |||
|
268 | > return self._o.write(msg) | |||
|
269 | > | |||
|
270 | > def uisetup(ui): | |||
|
271 | > class badui(ui.__class__): | |||
|
272 | > def write_err(self, *args, **kwargs): | |||
|
273 | > olderr = self.ferr | |||
|
274 | > try: | |||
|
275 | > self.ferr = fdproxy(self, olderr) | |||
|
276 | > return super(badui, self).write_err(*args, **kwargs) | |||
|
277 | > finally: | |||
|
278 | > self.ferr = olderr | |||
|
279 | > | |||
|
280 | > ui.__class__ = badui | |||
|
281 | > | |||
|
282 | > def reposetup(ui, repo): | |||
|
283 | > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui') | |||
|
284 | > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui') | |||
|
285 | > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui') | |||
|
286 | > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui') | |||
|
287 | > EOF | |||
|
288 | ||||
|
289 | $ cat >> $HGRCPATH << EOF | |||
|
290 | > [extensions] | |||
|
291 | > badui = $TESTTMP/badui.py | |||
|
292 | > EOF | |||
|
293 | ||||
|
294 | An I/O error during pretxncommit is handled | |||
|
295 | ||||
|
296 | $ hg init ioerror-pretxncommit | |||
|
297 | $ cd ioerror-pretxncommit | |||
|
298 | $ echo 0 > foo | |||
|
299 | $ hg -q commit -A -m initial | |||
|
300 | warn during pretxncommit | |||
|
301 | warn during pretxnclose | |||
|
302 | warn during txnclose | |||
|
303 | $ echo 1 > foo | |||
|
304 | $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit' | |||
|
305 | error: pretxncommit.badui hook raised an exception: [Errno *] simulated epipe (glob) | |||
|
306 | transaction abort! | |||
|
307 | warn during abort | |||
|
308 | rollback completed | |||
|
309 | [255] | |||
|
310 | ||||
|
311 | $ hg commit -m 'commit 1' | |||
|
312 | warn during pretxncommit | |||
|
313 | warn during pretxnclose | |||
|
314 | warn during txnclose | |||
|
315 | ||||
|
316 | $ cd .. | |||
|
317 | ||||
|
318 | An I/O error during pretxnclose is handled | |||
|
319 | ||||
|
320 | $ hg init ioerror-pretxnclose | |||
|
321 | $ cd ioerror-pretxnclose | |||
|
322 | $ echo 0 > foo | |||
|
323 | $ hg -q commit -A -m initial | |||
|
324 | warn during pretxncommit | |||
|
325 | warn during pretxnclose | |||
|
326 | warn during txnclose | |||
|
327 | ||||
|
328 | $ echo 1 > foo | |||
|
329 | $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose' | |||
|
330 | warn during pretxncommit | |||
|
331 | error: pretxnclose.badui hook raised an exception: [Errno *] simulated eio (glob) | |||
|
332 | transaction abort! | |||
|
333 | warn during abort | |||
|
334 | rollback completed | |||
|
335 | abort: simulated eio | |||
|
336 | [255] | |||
|
337 | ||||
|
338 | $ hg commit -m 'commit 1' | |||
|
339 | warn during pretxncommit | |||
|
340 | warn during pretxnclose | |||
|
341 | warn during txnclose | |||
|
342 | ||||
|
343 | $ cd .. | |||
|
344 | ||||
|
345 | An I/O error during txnclose is handled | |||
|
346 | ||||
|
347 | $ hg init ioerror-txnclose | |||
|
348 | $ cd ioerror-txnclose | |||
|
349 | $ echo 0 > foo | |||
|
350 | $ hg -q commit -A -m initial | |||
|
351 | warn during pretxncommit | |||
|
352 | warn during pretxnclose | |||
|
353 | warn during txnclose | |||
|
354 | ||||
|
355 | $ echo 1 > foo | |||
|
356 | $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose' | |||
|
357 | warn during pretxncommit | |||
|
358 | warn during pretxnclose | |||
|
359 | error: txnclose.badui hook raised an exception: [Errno *] simulated badf (glob) | |||
|
360 | (run with --traceback for stack trace) | |||
|
361 | ||||
|
362 | $ hg commit -m 'commit 1' | |||
|
363 | nothing changed | |||
|
364 | [1] | |||
|
365 | ||||
|
366 | $ cd .. | |||
|
367 | ||||
|
368 | An I/O error writing "transaction abort" is handled | |||
|
369 | ||||
|
370 | $ hg init ioerror-msgabort | |||
|
371 | $ cd ioerror-msgabort | |||
|
372 | ||||
|
373 | $ echo 0 > foo | |||
|
374 | $ hg -q commit -A -m initial | |||
|
375 | warn during pretxncommit | |||
|
376 | warn during pretxnclose | |||
|
377 | warn during txnclose | |||
|
378 | ||||
|
379 | $ echo 1 > foo | |||
|
380 | $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' | |||
|
381 | abort: simulated ebadf | |||
|
382 | *: DeprecationWarning: use lock.release instead of del lock (glob) | |||
|
383 | return -1 | |||
|
384 | [255] | |||
|
385 | ||||
|
386 | $ hg commit -m 'commit 1' | |||
|
387 | abort: abandoned transaction found! | |||
|
388 | (run 'hg recover' to clean up transaction) | |||
|
389 | [255] | |||
|
390 | ||||
|
391 | $ cd .. | |||
|
392 | ||||
|
393 | An I/O error during txnabort should still result in rollback | |||
|
394 | ||||
|
395 | $ hg init ioerror-txnabort | |||
|
396 | $ cd ioerror-txnabort | |||
|
397 | ||||
|
398 | $ echo 0 > foo | |||
|
399 | $ hg -q commit -A -m initial | |||
|
400 | warn during pretxncommit | |||
|
401 | warn during pretxnclose | |||
|
402 | warn during txnclose | |||
|
403 | ||||
|
404 | $ echo 1 > foo | |||
|
405 | $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' | |||
|
406 | transaction abort! | |||
|
407 | error: txnabort.badui hook raised an exception: [Errno *] simulated epipe (glob) | |||
|
408 | (run with --traceback for stack trace) | |||
|
409 | rollback completed | |||
|
410 | abort: pretxncommit hook exited with status 1 | |||
|
411 | [255] | |||
|
412 | ||||
|
413 | $ hg commit -m 'commit 1' | |||
|
414 | warn during pretxncommit | |||
|
415 | warn during pretxnclose | |||
|
416 | warn during txnclose | |||
|
417 | ||||
|
418 | $ cd .. | |||
|
419 | ||||
|
420 | An I/O error writing "rollback completed" is handled | |||
|
421 | ||||
|
422 | $ hg init ioerror-msgrollback | |||
|
423 | $ cd ioerror-msgrollback | |||
|
424 | ||||
|
425 | $ echo 0 > foo | |||
|
426 | $ hg -q commit -A -m initial | |||
|
427 | warn during pretxncommit | |||
|
428 | warn during pretxnclose | |||
|
429 | warn during txnclose | |||
|
430 | ||||
|
431 | $ echo 1 > foo | |||
|
432 | ||||
|
433 | $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' | |||
|
434 | transaction abort! | |||
|
435 | warn during abort | |||
|
436 | rollback failed - please run hg recover | |||
|
437 | abort: pretxncommit hook exited with status 1 | |||
|
438 | [255] | |||
|
439 | ||||
|
440 | $ hg verify | |||
|
441 | checking changesets | |||
|
442 | checking manifests | |||
|
443 | crosschecking files in changesets and manifests | |||
|
444 | checking files | |||
|
445 | 1 files, 1 changesets, 1 total revisions | |||
|
446 | ||||
|
447 | $ cd .. | |||
|
448 | ||||
|
449 | Multiple I/O errors after transaction open are handled. | |||
|
450 | This is effectively what happens if a peer disconnects in the middle | |||
|
451 | of a transaction. | |||
|
452 | ||||
|
453 | $ hg init ioerror-multiple | |||
|
454 | $ cd ioerror-multiple | |||
|
455 | $ echo 0 > foo | |||
|
456 | $ hg -q commit -A -m initial | |||
|
457 | warn during pretxncommit | |||
|
458 | warn during pretxnclose | |||
|
459 | warn during txnclose | |||
|
460 | ||||
|
461 | $ echo 1 > foo | |||
|
462 | ||||
|
463 | $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors' | |||
|
464 | error: pretxncommit.badui hook raised an exception: [Errno *] simulated epipe (glob) | |||
|
465 | abort: simulated ebadf | |||
|
466 | *: DeprecationWarning: use lock.release instead of del lock (glob) | |||
|
467 | return -1 | |||
|
468 | [255] | |||
|
469 | ||||
|
470 | $ hg verify | |||
|
471 | abandoned transaction found - run hg recover | |||
|
472 | checking changesets | |||
|
473 | checking manifests | |||
|
474 | manifest@?: rev 1 points to nonexistent changeset 1 | |||
|
475 | manifest@?: 94e0ee43dbfe not in changesets | |||
|
476 | crosschecking files in changesets and manifests | |||
|
477 | checking files | |||
|
478 | foo@?: rev 1 points to nonexistent changeset 1 | |||
|
479 | (expected 0) | |||
|
480 | 1 files, 1 changesets, 2 total revisions | |||
|
481 | 1 warnings encountered! | |||
|
482 | 3 integrity errors encountered! | |||
|
483 | [1] | |||
|
484 | ||||
|
485 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now