Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/chgserver.py @ 46016:aab70f05d6ec
chgserver: catch RepoError while loading configuration
Recent share safe work introduced functionality to read share source config file
on dispatch. This can result in RepoError while reading config file as the
shared source might not be present.
`test-share.t#safe` was failing with chg earlier because of this.
Differential Revision: https://phab.mercurial-scm.org/D9462
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Mon, 30 Nov 2020 14:11:03 +0530 |
parents | 7eb221b9af6c |
children | 59fa3890d40a |
comparison
equal
deleted
inserted
replaced
46015:c1bb02738f96 | 46016:aab70f05d6ec |
---|---|
502 If neither "reconnect" nor "redirect" is included in the instruction | 502 If neither "reconnect" nor "redirect" is included in the instruction |
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 try: | 508 try: |
508 self.ui, lui = _loadnewui(self.ui, args, self.cdebug) | 509 self.ui, lui = _loadnewui(self.ui, args, self.cdebug) |
510 except error.RepoError as inst: | |
511 # RepoError can be raised while trying to read shared source | |
512 # configuration | |
513 self.ui.error(_(b"abort: %s\n") % stringutil.forcebytestr(inst)) | |
514 if inst.hint: | |
515 self.ui.error(_(b"(%s)\n") % inst.hint) | |
516 errorraised = True | |
509 except error.Abort as inst: | 517 except error.Abort as inst: |
510 self.ui.error(inst.format()) | 518 self.ui.error(inst.format()) |
519 errorraised = True | |
520 | |
521 if errorraised: | |
511 self.ui.flush() | 522 self.ui.flush() |
512 self.cresult.write(b'exit 255') | 523 self.cresult.write(b'exit 255') |
513 return | 524 return |
514 newhash = hashstate.fromui(lui, self.hashstate.mtimepaths) | 525 newhash = hashstate.fromui(lui, self.hashstate.mtimepaths) |
515 insts = [] | 526 insts = [] |