##// END OF EJS Templates
configitems: register the test 'ui.ioerrors' config
Boris Feld -
r34767:d957d447 default
parent child Browse files
Show More
@@ -1,458 +1,466 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 new changesets 23b0221f3370:068774709090
137 new changesets 23b0221f3370:068774709090
138 updating to branch default
138 updating to branch default
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
139 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ cd u
140 $ cd u
141 $ hg id default
141 $ hg id default
142 068774709090
142 068774709090
143
143
144 now rollback and observe that 'hg serve' reloads the repository and
144 now rollback and observe that 'hg serve' reloads the repository and
145 presents the correct tip changeset:
145 presents the correct tip changeset:
146
146
147 $ hg -R ../t rollback
147 $ hg -R ../t rollback
148 repository tip rolled back to revision 1 (undo commit)
148 repository tip rolled back to revision 1 (undo commit)
149 working directory now based on revision 0
149 working directory now based on revision 0
150 $ hg id default
150 $ hg id default
151 791dd2169706
151 791dd2169706
152
152
153 $ killdaemons.py
153 $ killdaemons.py
154 #endif
154 #endif
155
155
156 update to older changeset and then refuse rollback, because
156 update to older changeset and then refuse rollback, because
157 that would lose data (issue2998)
157 that would lose data (issue2998)
158 $ cd ../t
158 $ cd ../t
159 $ hg -q update
159 $ hg -q update
160 $ rm `hg status -un`
160 $ rm `hg status -un`
161 $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n'
161 $ template='{rev}:{node|short} [{branch}] {desc|firstline}\n'
162 $ echo 'valuable new file' > b
162 $ echo 'valuable new file' > b
163 $ echo 'valuable modification' >> a
163 $ echo 'valuable modification' >> a
164 $ hg commit -A -m'a valuable change'
164 $ hg commit -A -m'a valuable change'
165 adding b
165 adding b
166 $ hg update 0
166 $ hg update 0
167 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
167 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
168 $ hg rollback
168 $ hg rollback
169 abort: rollback of last commit while not checked out may lose data
169 abort: rollback of last commit while not checked out may lose data
170 (use -f to force)
170 (use -f to force)
171 [255]
171 [255]
172 $ hg tip -q
172 $ hg tip -q
173 2:4d9cd3795eea
173 2:4d9cd3795eea
174 $ hg rollback -f
174 $ hg rollback -f
175 repository tip rolled back to revision 1 (undo commit)
175 repository tip rolled back to revision 1 (undo commit)
176 $ hg status
176 $ hg status
177 $ hg log --removed b # yep, it's gone
177 $ hg log --removed b # yep, it's gone
178
178
179 same again, but emulate an old client that doesn't write undo.desc
179 same again, but emulate an old client that doesn't write undo.desc
180 $ hg -q update
180 $ hg -q update
181 $ echo 'valuable modification redux' >> a
181 $ echo 'valuable modification redux' >> a
182 $ hg commit -m'a valuable change redux'
182 $ hg commit -m'a valuable change redux'
183 $ rm .hg/undo.desc
183 $ rm .hg/undo.desc
184 $ hg update 0
184 $ hg update 0
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 $ hg rollback
186 $ hg rollback
187 rolling back unknown transaction
187 rolling back unknown transaction
188 $ cat a
188 $ cat a
189 a
189 a
190
190
191 corrupt journal test
191 corrupt journal test
192 $ echo "foo" > .hg/store/journal
192 $ echo "foo" > .hg/store/journal
193 $ hg recover
193 $ hg recover
194 rolling back interrupted transaction
194 rolling back interrupted transaction
195 couldn't read journal entry 'foo\n'!
195 couldn't read journal entry 'foo\n'!
196 checking changesets
196 checking changesets
197 checking manifests
197 checking manifests
198 crosschecking files in changesets and manifests
198 crosschecking files in changesets and manifests
199 checking files
199 checking files
200 1 files, 2 changesets, 2 total revisions
200 1 files, 2 changesets, 2 total revisions
201
201
202 rollback disabled by config
202 rollback disabled by config
203 $ cat >> $HGRCPATH <<EOF
203 $ cat >> $HGRCPATH <<EOF
204 > [ui]
204 > [ui]
205 > rollback = false
205 > rollback = false
206 > EOF
206 > EOF
207 $ echo narf >> pinky-sayings.txt
207 $ echo narf >> pinky-sayings.txt
208 $ hg add pinky-sayings.txt
208 $ hg add pinky-sayings.txt
209 $ hg ci -m 'First one.'
209 $ hg ci -m 'First one.'
210 $ hg rollback
210 $ hg rollback
211 abort: rollback is disabled because it is unsafe
211 abort: rollback is disabled because it is unsafe
212 (see `hg help -v rollback` for information)
212 (see `hg help -v rollback` for information)
213 [255]
213 [255]
214
214
215 $ cd ..
215 $ cd ..
216
216
217 I/O errors on stdio are handled properly (issue5658)
217 I/O errors on stdio are handled properly (issue5658)
218
218
219 $ cat > badui.py << EOF
219 $ cat > badui.py << EOF
220 > import errno
220 > import errno
221 > from mercurial.i18n import _
221 > from mercurial.i18n import _
222 > from mercurial import (
222 > from mercurial import (
223 > registrar,
223 > error,
224 > error,
224 > ui as uimod,
225 > ui as uimod,
225 > )
226 > )
226 >
227 >
228 > configtable = {}
229 > configitem = registrar.configitem(configtable)
230 >
231 > configitem('ui', 'ioerrors',
232 > default=list,
233 > )
234 >
227 > def pretxncommit(ui, repo, **kwargs):
235 > def pretxncommit(ui, repo, **kwargs):
228 > ui.warn('warn during pretxncommit\n')
236 > ui.warn('warn during pretxncommit\n')
229 >
237 >
230 > def pretxnclose(ui, repo, **kwargs):
238 > def pretxnclose(ui, repo, **kwargs):
231 > ui.warn('warn during pretxnclose\n')
239 > ui.warn('warn during pretxnclose\n')
232 >
240 >
233 > def txnclose(ui, repo, **kwargs):
241 > def txnclose(ui, repo, **kwargs):
234 > ui.warn('warn during txnclose\n')
242 > ui.warn('warn during txnclose\n')
235 >
243 >
236 > def txnabort(ui, repo, **kwargs):
244 > def txnabort(ui, repo, **kwargs):
237 > ui.warn('warn during abort\n')
245 > ui.warn('warn during abort\n')
238 >
246 >
239 > class fdproxy(object):
247 > class fdproxy(object):
240 > def __init__(self, ui, o):
248 > def __init__(self, ui, o):
241 > self._ui = ui
249 > self._ui = ui
242 > self._o = o
250 > self._o = o
243 >
251 >
244 > def __getattr__(self, attr):
252 > def __getattr__(self, attr):
245 > return getattr(self._o, attr)
253 > return getattr(self._o, attr)
246 >
254 >
247 > def write(self, msg):
255 > def write(self, msg):
248 > errors = set(self._ui.configlist('ui', 'ioerrors', []))
256 > errors = set(self._ui.configlist('ui', 'ioerrors'))
249 > pretxncommit = msg == 'warn during pretxncommit\n'
257 > pretxncommit = msg == 'warn during pretxncommit\n'
250 > pretxnclose = msg == 'warn during pretxnclose\n'
258 > pretxnclose = msg == 'warn during pretxnclose\n'
251 > txnclose = msg == 'warn during txnclose\n'
259 > txnclose = msg == 'warn during txnclose\n'
252 > txnabort = msg == 'warn during abort\n'
260 > txnabort = msg == 'warn during abort\n'
253 > msgabort = msg == _('transaction abort!\n')
261 > msgabort = msg == _('transaction abort!\n')
254 > msgrollback = msg == _('rollback completed\n')
262 > msgrollback = msg == _('rollback completed\n')
255 >
263 >
256 > if pretxncommit and 'pretxncommit' in errors:
264 > if pretxncommit and 'pretxncommit' in errors:
257 > raise IOError(errno.EPIPE, 'simulated epipe')
265 > raise IOError(errno.EPIPE, 'simulated epipe')
258 > if pretxnclose and 'pretxnclose' in errors:
266 > if pretxnclose and 'pretxnclose' in errors:
259 > raise IOError(errno.EIO, 'simulated eio')
267 > raise IOError(errno.EIO, 'simulated eio')
260 > if txnclose and 'txnclose' in errors:
268 > if txnclose and 'txnclose' in errors:
261 > raise IOError(errno.EBADF, 'simulated badf')
269 > raise IOError(errno.EBADF, 'simulated badf')
262 > if txnabort and 'txnabort' in errors:
270 > if txnabort and 'txnabort' in errors:
263 > raise IOError(errno.EPIPE, 'simulated epipe')
271 > raise IOError(errno.EPIPE, 'simulated epipe')
264 > if msgabort and 'msgabort' in errors:
272 > if msgabort and 'msgabort' in errors:
265 > raise IOError(errno.EBADF, 'simulated ebadf')
273 > raise IOError(errno.EBADF, 'simulated ebadf')
266 > if msgrollback and 'msgrollback' in errors:
274 > if msgrollback and 'msgrollback' in errors:
267 > raise IOError(errno.EIO, 'simulated eio')
275 > raise IOError(errno.EIO, 'simulated eio')
268 >
276 >
269 > return self._o.write(msg)
277 > return self._o.write(msg)
270 >
278 >
271 > def uisetup(ui):
279 > def uisetup(ui):
272 > class badui(ui.__class__):
280 > class badui(ui.__class__):
273 > def write_err(self, *args, **kwargs):
281 > def write_err(self, *args, **kwargs):
274 > olderr = self.ferr
282 > olderr = self.ferr
275 > try:
283 > try:
276 > self.ferr = fdproxy(self, olderr)
284 > self.ferr = fdproxy(self, olderr)
277 > return super(badui, self).write_err(*args, **kwargs)
285 > return super(badui, self).write_err(*args, **kwargs)
278 > finally:
286 > finally:
279 > self.ferr = olderr
287 > self.ferr = olderr
280 >
288 >
281 > ui.__class__ = badui
289 > ui.__class__ = badui
282 >
290 >
283 > def reposetup(ui, repo):
291 > def reposetup(ui, repo):
284 > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui')
292 > ui.setconfig('hooks', 'pretxnclose.badui', pretxnclose, 'badui')
285 > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui')
293 > ui.setconfig('hooks', 'txnclose.badui', txnclose, 'badui')
286 > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui')
294 > ui.setconfig('hooks', 'pretxncommit.badui', pretxncommit, 'badui')
287 > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui')
295 > ui.setconfig('hooks', 'txnabort.badui', txnabort, 'badui')
288 > EOF
296 > EOF
289
297
290 $ cat >> $HGRCPATH << EOF
298 $ cat >> $HGRCPATH << EOF
291 > [extensions]
299 > [extensions]
292 > badui = $TESTTMP/badui.py
300 > badui = $TESTTMP/badui.py
293 > EOF
301 > EOF
294
302
295 An I/O error during pretxncommit is handled
303 An I/O error during pretxncommit is handled
296
304
297 $ hg init ioerror-pretxncommit
305 $ hg init ioerror-pretxncommit
298 $ cd ioerror-pretxncommit
306 $ cd ioerror-pretxncommit
299 $ echo 0 > foo
307 $ echo 0 > foo
300 $ hg -q commit -A -m initial
308 $ hg -q commit -A -m initial
301 warn during pretxncommit
309 warn during pretxncommit
302 warn during pretxnclose
310 warn during pretxnclose
303 warn during txnclose
311 warn during txnclose
304 $ echo 1 > foo
312 $ echo 1 > foo
305 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
313 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
306 warn during pretxnclose
314 warn during pretxnclose
307 warn during txnclose
315 warn during txnclose
308
316
309 $ hg commit -m 'commit 1'
317 $ hg commit -m 'commit 1'
310 nothing changed
318 nothing changed
311 [1]
319 [1]
312
320
313 $ cd ..
321 $ cd ..
314
322
315 An I/O error during pretxnclose is handled
323 An I/O error during pretxnclose is handled
316
324
317 $ hg init ioerror-pretxnclose
325 $ hg init ioerror-pretxnclose
318 $ cd ioerror-pretxnclose
326 $ cd ioerror-pretxnclose
319 $ echo 0 > foo
327 $ echo 0 > foo
320 $ hg -q commit -A -m initial
328 $ hg -q commit -A -m initial
321 warn during pretxncommit
329 warn during pretxncommit
322 warn during pretxnclose
330 warn during pretxnclose
323 warn during txnclose
331 warn during txnclose
324
332
325 $ echo 1 > foo
333 $ echo 1 > foo
326 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
334 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
327 warn during pretxncommit
335 warn during pretxncommit
328 warn during txnclose
336 warn during txnclose
329
337
330 $ hg commit -m 'commit 1'
338 $ hg commit -m 'commit 1'
331 nothing changed
339 nothing changed
332 [1]
340 [1]
333
341
334 $ cd ..
342 $ cd ..
335
343
336 An I/O error during txnclose is handled
344 An I/O error during txnclose is handled
337
345
338 $ hg init ioerror-txnclose
346 $ hg init ioerror-txnclose
339 $ cd ioerror-txnclose
347 $ cd ioerror-txnclose
340 $ echo 0 > foo
348 $ echo 0 > foo
341 $ hg -q commit -A -m initial
349 $ hg -q commit -A -m initial
342 warn during pretxncommit
350 warn during pretxncommit
343 warn during pretxnclose
351 warn during pretxnclose
344 warn during txnclose
352 warn during txnclose
345
353
346 $ echo 1 > foo
354 $ echo 1 > foo
347 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
355 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
348 warn during pretxncommit
356 warn during pretxncommit
349 warn during pretxnclose
357 warn during pretxnclose
350
358
351 $ hg commit -m 'commit 1'
359 $ hg commit -m 'commit 1'
352 nothing changed
360 nothing changed
353 [1]
361 [1]
354
362
355 $ cd ..
363 $ cd ..
356
364
357 An I/O error writing "transaction abort" is handled
365 An I/O error writing "transaction abort" is handled
358
366
359 $ hg init ioerror-msgabort
367 $ hg init ioerror-msgabort
360 $ cd ioerror-msgabort
368 $ cd ioerror-msgabort
361
369
362 $ echo 0 > foo
370 $ echo 0 > foo
363 $ hg -q commit -A -m initial
371 $ hg -q commit -A -m initial
364 warn during pretxncommit
372 warn during pretxncommit
365 warn during pretxnclose
373 warn during pretxnclose
366 warn during txnclose
374 warn during txnclose
367
375
368 $ echo 1 > foo
376 $ echo 1 > foo
369 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
377 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
370 warn during abort
378 warn during abort
371 rollback completed
379 rollback completed
372 abort: pretxncommit hook exited with status 1
380 abort: pretxncommit hook exited with status 1
373 [255]
381 [255]
374
382
375 $ hg commit -m 'commit 1'
383 $ hg commit -m 'commit 1'
376 warn during pretxncommit
384 warn during pretxncommit
377 warn during pretxnclose
385 warn during pretxnclose
378 warn during txnclose
386 warn during txnclose
379
387
380 $ cd ..
388 $ cd ..
381
389
382 An I/O error during txnabort should still result in rollback
390 An I/O error during txnabort should still result in rollback
383
391
384 $ hg init ioerror-txnabort
392 $ hg init ioerror-txnabort
385 $ cd ioerror-txnabort
393 $ cd ioerror-txnabort
386
394
387 $ echo 0 > foo
395 $ echo 0 > foo
388 $ hg -q commit -A -m initial
396 $ hg -q commit -A -m initial
389 warn during pretxncommit
397 warn during pretxncommit
390 warn during pretxnclose
398 warn during pretxnclose
391 warn during txnclose
399 warn during txnclose
392
400
393 $ echo 1 > foo
401 $ echo 1 > foo
394 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
402 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
395 transaction abort!
403 transaction abort!
396 rollback completed
404 rollback completed
397 abort: pretxncommit hook exited with status 1
405 abort: pretxncommit hook exited with status 1
398 [255]
406 [255]
399
407
400 $ hg commit -m 'commit 1'
408 $ hg commit -m 'commit 1'
401 warn during pretxncommit
409 warn during pretxncommit
402 warn during pretxnclose
410 warn during pretxnclose
403 warn during txnclose
411 warn during txnclose
404
412
405 $ cd ..
413 $ cd ..
406
414
407 An I/O error writing "rollback completed" is handled
415 An I/O error writing "rollback completed" is handled
408
416
409 $ hg init ioerror-msgrollback
417 $ hg init ioerror-msgrollback
410 $ cd ioerror-msgrollback
418 $ cd ioerror-msgrollback
411
419
412 $ echo 0 > foo
420 $ echo 0 > foo
413 $ hg -q commit -A -m initial
421 $ hg -q commit -A -m initial
414 warn during pretxncommit
422 warn during pretxncommit
415 warn during pretxnclose
423 warn during pretxnclose
416 warn during txnclose
424 warn during txnclose
417
425
418 $ echo 1 > foo
426 $ echo 1 > foo
419
427
420 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
428 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
421 transaction abort!
429 transaction abort!
422 warn during abort
430 warn during abort
423 abort: pretxncommit hook exited with status 1
431 abort: pretxncommit hook exited with status 1
424 [255]
432 [255]
425
433
426 $ hg verify
434 $ hg verify
427 checking changesets
435 checking changesets
428 checking manifests
436 checking manifests
429 crosschecking files in changesets and manifests
437 crosschecking files in changesets and manifests
430 checking files
438 checking files
431 1 files, 1 changesets, 1 total revisions
439 1 files, 1 changesets, 1 total revisions
432
440
433 $ cd ..
441 $ cd ..
434
442
435 Multiple I/O errors after transaction open are handled.
443 Multiple I/O errors after transaction open are handled.
436 This is effectively what happens if a peer disconnects in the middle
444 This is effectively what happens if a peer disconnects in the middle
437 of a transaction.
445 of a transaction.
438
446
439 $ hg init ioerror-multiple
447 $ hg init ioerror-multiple
440 $ cd ioerror-multiple
448 $ cd ioerror-multiple
441 $ echo 0 > foo
449 $ echo 0 > foo
442 $ hg -q commit -A -m initial
450 $ hg -q commit -A -m initial
443 warn during pretxncommit
451 warn during pretxncommit
444 warn during pretxnclose
452 warn during pretxnclose
445 warn during txnclose
453 warn during txnclose
446
454
447 $ echo 1 > foo
455 $ echo 1 > foo
448
456
449 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors'
457 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors'
450
458
451 $ hg verify
459 $ hg verify
452 checking changesets
460 checking changesets
453 checking manifests
461 checking manifests
454 crosschecking files in changesets and manifests
462 crosschecking files in changesets and manifests
455 checking files
463 checking files
456 1 files, 2 changesets, 2 total revisions
464 1 files, 2 changesets, 2 total revisions
457
465
458 $ cd ..
466 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now