##// END OF EJS Templates
ui: restore behavior to ignore some I/O errors (issue5658)...
Gregory Szorc -
r33859:cde4cfeb stable
parent child Browse files
Show More
@@ -904,7 +904,8 class ui(object):
904 if not getattr(self.ferr, 'closed', False):
904 if not getattr(self.ferr, 'closed', False):
905 self.ferr.flush()
905 self.ferr.flush()
906 except IOError as inst:
906 except IOError as inst:
907 raise error.StdioError(inst)
907 if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
908 raise error.StdioError(inst)
908
909
909 def flush(self):
910 def flush(self):
910 # opencode timeblockedsection because this is a critical path
911 # opencode timeblockedsection because this is a critical path
@@ -913,12 +914,14 class ui(object):
913 try:
914 try:
914 self.fout.flush()
915 self.fout.flush()
915 except IOError as err:
916 except IOError as err:
916 raise error.StdioError(err)
917 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
918 raise error.StdioError(err)
917 finally:
919 finally:
918 try:
920 try:
919 self.ferr.flush()
921 self.ferr.flush()
920 except IOError as err:
922 except IOError as err:
921 raise error.StdioError(err)
923 if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
924 raise error.StdioError(err)
922 finally:
925 finally:
923 self._blockedtimes['stdio_blocked'] += \
926 self._blockedtimes['stdio_blocked'] += \
924 (util.timer() - starttime) * 1000
927 (util.timer() - starttime) * 1000
@@ -302,16 +302,12 An I/O error during pretxncommit is hand
302 warn during txnclose
302 warn during txnclose
303 $ echo 1 > foo
303 $ echo 1 > foo
304 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
304 $ hg --config ui.ioerrors=pretxncommit commit -m 'error during pretxncommit'
305 error: pretxncommit.badui hook raised an exception: [Errno *] simulated epipe (glob)
305 warn during pretxnclose
306 transaction abort!
306 warn during txnclose
307 warn during abort
308 rollback completed
309 [255]
310
307
311 $ hg commit -m 'commit 1'
308 $ hg commit -m 'commit 1'
312 warn during pretxncommit
309 nothing changed
313 warn during pretxnclose
310 [1]
314 warn during txnclose
315
311
316 $ cd ..
312 $ cd ..
317
313
@@ -328,17 +324,11 An I/O error during pretxnclose is handl
328 $ echo 1 > foo
324 $ echo 1 > foo
329 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
325 $ hg --config ui.ioerrors=pretxnclose commit -m 'error during pretxnclose'
330 warn during pretxncommit
326 warn during pretxncommit
331 error: pretxnclose.badui hook raised an exception: [Errno *] simulated eio (glob)
327 warn during txnclose
332 transaction abort!
333 warn during abort
334 rollback completed
335 abort: simulated eio
336 [255]
337
328
338 $ hg commit -m 'commit 1'
329 $ hg commit -m 'commit 1'
339 warn during pretxncommit
330 nothing changed
340 warn during pretxnclose
331 [1]
341 warn during txnclose
342
332
343 $ cd ..
333 $ cd ..
344
334
@@ -356,8 +346,6 An I/O error during txnclose is handled
356 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
346 $ hg --config ui.ioerrors=txnclose commit -m 'error during txnclose'
357 warn during pretxncommit
347 warn during pretxncommit
358 warn during pretxnclose
348 warn during pretxnclose
359 error: txnclose.badui hook raised an exception: [Errno *] simulated badf (glob)
360 (run with --traceback for stack trace)
361
349
362 $ hg commit -m 'commit 1'
350 $ hg commit -m 'commit 1'
363 nothing changed
351 nothing changed
@@ -378,15 +366,15 An I/O error writing "transaction abort"
378
366
379 $ echo 1 > foo
367 $ echo 1 > foo
380 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
368 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
381 abort: simulated ebadf
369 warn during abort
382 *: DeprecationWarning: use lock.release instead of del lock (glob)
370 rollback completed
383 return -1
371 abort: pretxncommit hook exited with status 1
384 [255]
372 [255]
385
373
386 $ hg commit -m 'commit 1'
374 $ hg commit -m 'commit 1'
387 abort: abandoned transaction found!
375 warn during pretxncommit
388 (run 'hg recover' to clean up transaction)
376 warn during pretxnclose
389 [255]
377 warn during txnclose
390
378
391 $ cd ..
379 $ cd ..
392
380
@@ -404,8 +392,6 An I/O error during txnabort should stil
404 $ echo 1 > foo
392 $ echo 1 > foo
405 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
393 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
406 transaction abort!
394 transaction abort!
407 error: txnabort.badui hook raised an exception: [Errno *] simulated epipe (glob)
408 (run with --traceback for stack trace)
409 rollback completed
395 rollback completed
410 abort: pretxncommit hook exited with status 1
396 abort: pretxncommit hook exited with status 1
411 [255]
397 [255]
@@ -433,7 +419,6 An I/O error writing "rollback completed
433 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
419 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
434 transaction abort!
420 transaction abort!
435 warn during abort
421 warn during abort
436 rollback failed - please run hg recover
437 abort: pretxncommit hook exited with status 1
422 abort: pretxncommit hook exited with status 1
438 [255]
423 [255]
439
424
@@ -461,25 +446,12 of a transaction.
461 $ echo 1 > foo
446 $ echo 1 > foo
462
447
463 $ hg --config ui.ioerrors=pretxncommit,pretxnclose,txnclose,txnabort,msgabort,msgrollback commit -m 'multiple errors'
448 $ 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
449
470 $ hg verify
450 $ hg verify
471 abandoned transaction found - run hg recover
472 checking changesets
451 checking changesets
473 checking manifests
452 checking manifests
474 manifest@?: rev 1 points to nonexistent changeset 1
475 manifest@?: 94e0ee43dbfe not in changesets
476 crosschecking files in changesets and manifests
453 crosschecking files in changesets and manifests
477 checking files
454 checking files
478 foo@?: rev 1 points to nonexistent changeset 1
455 1 files, 2 changesets, 2 total revisions
479 (expected 0)
480 1 files, 1 changesets, 2 total revisions
481 1 warnings encountered!
482 3 integrity errors encountered!
483 [1]
484
456
485 $ cd ..
457 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now