[Request] [+ ] D9630: errors: respect ui.detailed-exit-code in chg
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Dec 17 18:48:41 UTC 2020
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
This fixes `test-globalopts.t`, which has been failing since
db5dddb38f5b <https://phab.mercurial-scm.org/rHGdb5dddb38f5b95e626d6659f3e4be7e0c7403693> (errors: raise InputError on early parse error in
dispatch, 2020-11-23).
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D9630
AFFECTED FILES
mercurial/chgserver.py
CHANGE DETAILS
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -505,6 +505,7 @@
"""
args = self._readlist()
errorraised = False
+ detailed_exit_code = 255
try:
self.ui, lui = _loadnewui(self.ui, args, self.cdebug)
except error.RepoError as inst:
@@ -515,12 +516,17 @@
self.ui.error(_(b"(%s)\n") % inst.hint)
errorraised = True
except error.Abort as inst:
+ if isinstance(inst, error.InputError):
+ detailed_exit_code = 10
self.ui.error(inst.format())
errorraised = True
if errorraised:
self.ui.flush()
- self.cresult.write(b'exit 255')
+ exit_code = 255
+ if self.ui.configbool(b'ui', b'detailed-exit-code'):
+ exit_code = detailed_exit_code
+ self.cresult.write(b'exit %d' % exit_code)
return
newhash = hashstate.fromui(lui, self.hashstate.mtimepaths)
insts = []
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20201217/815ccb52/attachment-0001.html>
More information about the Mercurial-patches
mailing list