comparison tests/test-rollback.t @ 46417:768056549737

errors: use exit code 40 for when a hook fails A hook can be used for checking inputs, state, configuration, security, etc., so it's unclear which of the existing exit codes to use. Let's instead add one specifically for failed hooks. I picked 40. Differential Revision: https://phab.mercurial-scm.org/D9910
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 29 Jan 2021 12:16:55 -0800
parents c6d31e659a28
children 2f2682f40ea0
comparison
equal deleted inserted replaced
46416:bc3f3b59d0a4 46417:768056549737
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 [40]
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
116 transaction abort! 116 transaction abort!
117 rollback completed 117 rollback completed
118 note: commit message saved in .hg/last-message.txt 118 note: commit message saved in .hg/last-message.txt
119 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it 119 note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it
120 abort: pretxncommit hook exited with status * (glob) 120 abort: pretxncommit hook exited with status * (glob)
121 [255] 121 [40]
122 $ cat .hg/last-message.txt 122 $ cat .hg/last-message.txt
123 another precious commit message 123 another precious commit message
124 124
125 test rollback on served repository 125 test rollback on served repository
126 126
378 $ echo 1 > foo 378 $ echo 1 > foo
379 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message' 379 $ hg --config ui.ioerrors=msgabort --config hooks.pretxncommit=false commit -m 'error during abort message'
380 warn during abort 380 warn during abort
381 rollback completed 381 rollback completed
382 abort: pretxncommit hook exited with status 1 382 abort: pretxncommit hook exited with status 1
383 [255] 383 [40]
384 384
385 $ hg commit -m 'commit 1' 385 $ hg commit -m 'commit 1'
386 warn during pretxncommit 386 warn during pretxncommit
387 warn during pretxnclose 387 warn during pretxnclose
388 warn during txnclose 388 warn during txnclose
403 $ echo 1 > foo 403 $ echo 1 > foo
404 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort' 404 $ hg --config ui.ioerrors=txnabort --config hooks.pretxncommit=false commit -m 'error during abort'
405 transaction abort! 405 transaction abort!
406 rollback completed 406 rollback completed
407 abort: pretxncommit hook exited with status 1 407 abort: pretxncommit hook exited with status 1
408 [255] 408 [40]
409 409
410 $ hg commit -m 'commit 1' 410 $ hg commit -m 'commit 1'
411 warn during pretxncommit 411 warn during pretxncommit
412 warn during pretxnclose 412 warn during pretxnclose
413 warn during txnclose 413 warn during txnclose
429 429
430 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message' 430 $ hg --config ui.ioerrors=msgrollback --config hooks.pretxncommit=false commit -m 'error during rollback message'
431 transaction abort! 431 transaction abort!
432 warn during abort 432 warn during abort
433 abort: pretxncommit hook exited with status 1 433 abort: pretxncommit hook exited with status 1
434 [255] 434 [40]
435 435
436 $ hg verify 436 $ hg verify
437 checking changesets 437 checking changesets
438 checking manifests 438 checking manifests
439 crosschecking files in changesets and manifests 439 crosschecking files in changesets and manifests