diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -229,6 +229,8 @@ detailed_exit_code = 20 elif isinstance(inst, error.ConfigError): detailed_exit_code = 30 + elif isinstance(inst, error.HookAbort): + detailed_exit_code = 40 elif isinstance(inst, error.SecurityError): detailed_exit_code = 150 elif isinstance(inst, error.CanceledError): diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t +++ b/tests/test-bookmarks-pushpull.t @@ -1177,7 +1177,7 @@ searching for changes no changes found abort: prepushkey hook exited with status 1 - [255] + [40] #endif diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -1125,7 +1125,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ cp .hg/bookmarks.pending.saved .hg/bookmarks.pending (check visible bookmarks while transaction running in repo) @@ -1158,7 +1158,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] Check pretxnclose-bookmark can abort a transaction -------------------------------------------------- @@ -1242,7 +1242,7 @@ transaction abort! rollback completed abort: pretxnclose-bookmark.force-public hook exited with status 1 - [255] + [40] create on a public changeset @@ -1254,4 +1254,4 @@ transaction abort! rollback completed abort: pretxnclose-bookmark.force-forward hook exited with status 1 - [255] + [40] diff --git a/tests/test-bundle2-exchange.t b/tests/test-bundle2-exchange.t --- a/tests/test-bundle2-exchange.t +++ b/tests/test-bundle2-exchange.t @@ -638,7 +638,7 @@ remote: Cleaning up the mess... remote: rollback completed abort: pretxnclose.failpush hook exited with status 1 - [255] + [40] $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 pushing to ssh://user@dummy/other @@ -699,7 +699,7 @@ remote: Cleaning up the mess... remote: rollback completed abort: pretxnchangegroup hook exited with status 1 - [255] + [40] $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 pushing to ssh://user@dummy/other searching for changes @@ -747,7 +747,7 @@ Cleaning up the mess... rollback completed abort: pretxnchangegroup hook exited with status 1 - [255] + [40] $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6 pushing to ssh://user@dummy/other searching for changes diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -522,7 +522,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] *** runcommand verify checking changesets checking manifests @@ -1013,7 +1013,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] *** runcommand log *** runcommand verify -q @@ -1057,7 +1057,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] *** runcommand log 0 bar (bar) *** runcommand verify -q diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -209,7 +209,7 @@ transaction abort! rollback completed abort: pretxncommit.test-saving-last-message hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt message given from command line (no-eol) @@ -234,7 +234,7 @@ transaction abort! rollback completed abort: pretxncommit.test-saving-last-message hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt another precious commit message diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t --- a/tests/test-dispatch.t +++ b/tests/test-dispatch.t @@ -154,7 +154,7 @@ $ HGPLAIN=+strictflags hg --config='hooks.pre-log=false' log -b default abort: pre-log hook exited with status 1 - [255] + [40] $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default 0:cb9a9f314b8b $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default @@ -166,7 +166,7 @@ $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default abort: pre-log hook exited with status 1 - [255] + [40] $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default 0:cb9a9f314b8b diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t --- a/tests/test-histedit-edit.t +++ b/tests/test-histedit-edit.t @@ -375,7 +375,7 @@ note: commit message saved in .hg/last-message.txt note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt f @@ -400,7 +400,7 @@ note: commit message saved in .hg/last-message.txt note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat >> .hg/hgrc < [hooks] diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t --- a/tests/test-histedit-fold.t +++ b/tests/test-histedit-fold.t @@ -202,7 +202,7 @@ transaction abort! rollback completed abort: pretxncommit.abortfolding hook failed - [255] + [40] $ cat .hg/last-message.txt f diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -227,7 +227,7 @@ HG_PATS=[] abort: pre-identify hook exited with status 1 - [255] + [40] $ hg cat b pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat @@ -390,7 +390,7 @@ HG_TAG=fa abort: pretag.forbid hook exited with status 1 - [255] + [40] $ hg tag -l fla pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag @@ -405,7 +405,7 @@ HG_TAG=fla abort: pretag.forbid hook exited with status 1 - [255] + [40] pretxncommit hook can see changeset, can roll back txn, changeset no more there after @@ -451,7 +451,7 @@ rollback completed abort: pretxncommit.forbid1 hook exited with status 1 - [255] + [40] $ hg -q tip 4:539e4b31b6dc @@ -485,7 +485,7 @@ HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 abort: precommit.forbid hook exited with status 1 - [255] + [40] $ hg -q tip 4:539e4b31b6dc @@ -644,7 +644,7 @@ HG_URL=file:$TESTTMP/a abort: prepushkey hook exited with status 1 - [255] + [40] $ cd ../a test that prelistkeys can prevent listing keys @@ -679,7 +679,7 @@ HG_NAMESPACE=bookmarks abort: prelistkeys hook exited with status 1 - [255] + [40] $ cd ../a $ rm .hg/hgrc @@ -704,7 +704,7 @@ HG_URL=file:$TESTTMP/a abort: prechangegroup.forbid hook exited with status 1 - [255] + [40] pretxnchangegroup hook can see incoming changes, can roll back txn, incoming changes no longer there after @@ -735,7 +735,7 @@ transaction abort! rollback completed abort: pretxnchangegroup.forbid1 hook exited with status 1 - [255] + [40] $ hg -q tip 3:07f3376c1e65 @@ -786,7 +786,7 @@ HG_SOURCE=pull abort: preoutgoing.forbid hook exited with status 1 - [255] + [40] outgoing hooks work for local clones @@ -825,7 +825,7 @@ HG_SOURCE=clone abort: preoutgoing.forbid hook exited with status 1 - [255] + [40] $ cd "$TESTTMP/b" @@ -915,7 +915,7 @@ hooktype preoutgoing source pull abort: preoutgoing.fail hook failed - [255] + [40] $ echo '[hooks]' > ../a/.hg/hgrc $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc @@ -1283,7 +1283,7 @@ rollback completed strip failed, backup bundle stored in * (glob) abort: pretxnclose.error hook exited with status 1 - [255] + [40] $ hg recover no interrupted transaction available [1] @@ -1306,7 +1306,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a (check (in)visibility of new changeset while transaction running in @@ -1331,7 +1331,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] Hook from untrusted hgrc are reported as failure ================================================ @@ -1382,7 +1382,7 @@ rollback completed abort: untrusted hook pretxnclose.testing not executed (see 'hg help config.trusted') - [255] + [40] $ hg log changeset: 0:3903775176ed tag: tip diff --git a/tests/test-mactext.t b/tests/test-mactext.t --- a/tests/test-mactext.t +++ b/tests/test-mactext.t @@ -27,7 +27,7 @@ transaction abort! rollback completed abort: pretxncommit.cr hook failed - [255] + [40] $ hg cat f | f --hexdump 0000: 68 65 6c 6c 6f 0a |hello.| diff --git a/tests/test-merge-tools.t b/tests/test-merge-tools.t --- a/tests/test-merge-tools.t +++ b/tests/test-merge-tools.t @@ -377,7 +377,7 @@ merging f some fail message abort: $TESTTMP/mybrokenmerge.py hook failed - [255] + [40] $ aftermerge # cat f revision 1 diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t --- a/tests/test-mq-qfold.t +++ b/tests/test-mq-qfold.t @@ -235,7 +235,7 @@ rollback completed qrefresh interrupted while patch was popped! (revert --all, qpush to recover) abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt original message diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t --- a/tests/test-mq-qnew.t +++ b/tests/test-mq-qnew.t @@ -310,7 +310,7 @@ note: commit message saved in .hg/last-message.txt note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt diff --git a/tests/test-mq-qrefresh-replace-log-message.t b/tests/test-mq-qrefresh-replace-log-message.t --- a/tests/test-mq-qrefresh-replace-log-message.t +++ b/tests/test-mq-qrefresh-replace-log-message.t @@ -191,7 +191,7 @@ rollback completed qrefresh interrupted while patch was popped! (revert --all, qpush to recover) abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt Fifth commit message This is the 5th log message @@ -235,7 +235,7 @@ rollback completed qrefresh interrupted while patch was popped! (revert --all, qpush to recover) abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] (rebuilding at failure of qrefresh bases on rev #0, and it causes dropping status of "file2") @@ -273,7 +273,7 @@ rollback completed qrefresh interrupted while patch was popped! (revert --all, qpush to recover) abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ sh "$TESTTMP/checkvisibility.sh" ==== @@ -315,7 +315,7 @@ rollback completed qrefresh interrupted while patch was popped! (revert --all, qpush to recover) abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ sh "$TESTTMP/checkvisibility.sh" ==== diff --git a/tests/test-narrow-pull.t b/tests/test-narrow-pull.t --- a/tests/test-narrow-pull.t +++ b/tests/test-narrow-pull.t @@ -78,7 +78,7 @@ transaction abort! rollback completed abort: pretxnchangegroup.bad hook exited with status 1 - [255] + [40] $ hg id 223311e70a6f tip diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen.t --- a/tests/test-narrow-widen.t +++ b/tests/test-narrow-widen.t @@ -431,7 +431,7 @@ transaction abort! rollback completed abort: pretxnchangegroup.bad hook exited with status 1 - [255] + [40] $ hg l $ hg bookmarks no bookmarks set diff --git a/tests/test-phases.t b/tests/test-phases.t --- a/tests/test-phases.t +++ b/tests/test-phases.t @@ -757,7 +757,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ cp .hg/store/phaseroots.pending.saved .hg/store/phaseroots.pending (check (in)visibility of phaseroot while transaction running in repo) @@ -780,7 +780,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] Check that pretxnclose-phase hook can control phase movement @@ -854,12 +854,12 @@ transaction abort! rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 - [255] + [40] $ hg phase --public a603bfb5a83e transaction abort! rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 - [255] + [40] $ hg phase --draft 17a481b3bccb test-debug-phase: move rev 3: 2 -> 1 test-debug-phase: move rev 4: 2 -> 1 @@ -871,7 +871,7 @@ transaction abort! rollback completed abort: pretxnclose-phase.nopublish_D hook exited with status 1 - [255] + [40] $ cd .. diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t --- a/tests/test-rebase-interruptions.t +++ b/tests/test-rebase-interruptions.t @@ -350,7 +350,7 @@ M A rebasing 6:a0b2430ebfb8 tip "F" abort: precommit hook exited with status 1 - [255] + [40] $ hg tglogp @ 7: 401ccec5e39f secret 'C' | @@ -401,7 +401,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] $ hg tglogp @ 7: 401ccec5e39f secret 'C' | @@ -451,7 +451,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ hg tglogp @ 7: 401ccec5e39f secret 'C' | diff --git a/tests/test-rollback.t b/tests/test-rollback.t --- a/tests/test-rollback.t +++ b/tests/test-rollback.t @@ -103,7 +103,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status * (glob) - [255] + [40] $ cat .hg/last-message.txt ; echo precious commit message @@ -118,7 +118,7 @@ note: commit message saved in .hg/last-message.txt note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it abort: pretxncommit hook exited with status * (glob) - [255] + [40] $ cat .hg/last-message.txt another precious commit message @@ -380,7 +380,7 @@ warn during abort rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] $ hg commit -m 'commit 1' warn during pretxncommit @@ -405,7 +405,7 @@ transaction abort! rollback completed abort: pretxncommit hook exited with status 1 - [255] + [40] $ hg commit -m 'commit 1' warn during pretxncommit @@ -431,7 +431,7 @@ transaction abort! warn during abort abort: pretxncommit hook exited with status 1 - [255] + [40] $ hg verify checking changesets diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t --- a/tests/test-share-bookmarks.t +++ b/tests/test-share-bookmarks.t @@ -102,7 +102,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ hg book bm1 FYI, in contrast to above test, bmX is invisible in repo1 (= shared @@ -127,7 +127,7 @@ transaction abort! rollback completed abort: pretxnclose hook exited with status 1 - [255] + [40] $ hg book bm3 clean up bm2 since it's uninteresting (not shared in the vfs case and @@ -249,7 +249,7 @@ no changes found adding remote bookmark bm3 abort: forced failure by extension - [255] + [40] $ hg boo bm1 3:b87954705719 bm4 5:92793bfc8cad diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -427,7 +427,7 @@ strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob) (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob) abort: pretxnchangegroup.bad hook exited with status 1 - [255] + [40] $ restore $ hg log -G o changeset: 4:443431ffac4f diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -290,7 +290,7 @@ $ rm -f .hg/last-message.txt $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e abort: pretag.test-saving-lastmessage hook exited with status 1 - [255] + [40] $ test -f .hg/last-message.txt [1] @@ -325,7 +325,7 @@ note: commit message saved in .hg/last-message.txt note: use 'hg commit --logfile .hg/last-message.txt --edit' to reuse it abort: pretxncommit.unexpectedabort hook exited with status 1 - [255] + [40] $ cat .hg/last-message.txt custom tag message second line diff --git a/tests/test-transplant.t b/tests/test-transplant.t --- a/tests/test-transplant.t +++ b/tests/test-transplant.t @@ -1091,7 +1091,7 @@ transaction abort! rollback completed abort: pretxncommit.abort hook exited with status 1 - [255] + [40] $ cat >> .hg/hgrc < [hooks] > pretxncommit.abort = ! diff --git a/tests/test-win32text.t b/tests/test-win32text.t --- a/tests/test-win32text.t +++ b/tests/test-win32text.t @@ -38,7 +38,7 @@ transaction abort! rollback completed abort: pretxncommit.crlf hook failed - [255] + [40] $ mv .hg/hgrc .hg/hgrc.bak @@ -77,7 +77,7 @@ transaction abort! rollback completed abort: pretxnchangegroup.crlf hook failed - [255] + [40] $ mv .hg/hgrc.bak .hg/hgrc $ echo hello > f @@ -109,7 +109,7 @@ transaction abort! rollback completed abort: pretxncommit.crlf hook failed - [255] + [40] $ hg revert -a forgetting d/f2 $ rm d/f2 @@ -286,7 +286,7 @@ transaction abort! rollback completed abort: pretxnchangegroup.crlf hook failed - [255] + [40] $ hg log -v changeset: 5:f0b1c8d75fce