[Updated] D9630: errors: respect ui.detailed-exit-code in chg

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Dec 17 18:58:43 UTC 2020


Closed by commit rHGdadca47e3d4d: errors: respect ui.detailed-exit-code in chg (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9630?vs=24347&id=24349

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9630/new/

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, mharbison72
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201217/5f56182c/attachment-0002.html>


More information about the Mercurial-patches mailing list