Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/chgserver.py @ 46144:dadca47e3d4d
errors: respect ui.detailed-exit-code in chg
This fixes `test-globalopts.t`, which has been failing since
db5dddb38f5b (errors: raise InputError on early parse error in
dispatch, 2020-11-23).
Differential Revision: https://phab.mercurial-scm.org/D9630
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 17 Dec 2020 10:43:43 -0800 |
parents | 59fa3890d40a |
children | 6383bb86b700 |
comparison
equal
deleted
inserted
replaced
46143:634cea2c247f | 46144:dadca47e3d4d |
---|---|
503 list, the client can continue with this server after completing all | 503 list, the client can continue with this server after completing all |
504 the instructions. | 504 the instructions. |
505 """ | 505 """ |
506 args = self._readlist() | 506 args = self._readlist() |
507 errorraised = False | 507 errorraised = False |
508 detailed_exit_code = 255 | |
508 try: | 509 try: |
509 self.ui, lui = _loadnewui(self.ui, args, self.cdebug) | 510 self.ui, lui = _loadnewui(self.ui, args, self.cdebug) |
510 except error.RepoError as inst: | 511 except error.RepoError as inst: |
511 # RepoError can be raised while trying to read shared source | 512 # RepoError can be raised while trying to read shared source |
512 # configuration | 513 # configuration |
513 self.ui.error(_(b"abort: %s\n") % stringutil.forcebytestr(inst)) | 514 self.ui.error(_(b"abort: %s\n") % stringutil.forcebytestr(inst)) |
514 if inst.hint: | 515 if inst.hint: |
515 self.ui.error(_(b"(%s)\n") % inst.hint) | 516 self.ui.error(_(b"(%s)\n") % inst.hint) |
516 errorraised = True | 517 errorraised = True |
517 except error.Abort as inst: | 518 except error.Abort as inst: |
519 if isinstance(inst, error.InputError): | |
520 detailed_exit_code = 10 | |
518 self.ui.error(inst.format()) | 521 self.ui.error(inst.format()) |
519 errorraised = True | 522 errorraised = True |
520 | 523 |
521 if errorraised: | 524 if errorraised: |
522 self.ui.flush() | 525 self.ui.flush() |
523 self.cresult.write(b'exit 255') | 526 exit_code = 255 |
527 if self.ui.configbool(b'ui', b'detailed-exit-code'): | |
528 exit_code = detailed_exit_code | |
529 self.cresult.write(b'exit %d' % exit_code) | |
524 return | 530 return |
525 newhash = hashstate.fromui(lui, self.hashstate.mtimepaths) | 531 newhash = hashstate.fromui(lui, self.hashstate.mtimepaths) |
526 insts = [] | 532 insts = [] |
527 if newhash.mtimehash != self.hashstate.mtimehash: | 533 if newhash.mtimehash != self.hashstate.mtimehash: |
528 addr = _hashaddress(self.baseaddress, self.hashstate.confighash) | 534 addr = _hashaddress(self.baseaddress, self.hashstate.confighash) |