Details
Details
- Reviewers
dlax indygreg - Group Reviewers
hg-reviewers - Commits
- rHGac8fd215a776: dispatch: add some assertions to give pytype a helping hand
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
dlax | |
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/dispatch.py (5 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
ff8043ffec53 | 0aa67519a01f | Augie Fackler | Nov 14 2019, 3:49 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Abandoned | durin42 | ||
Abandoned | durin42 | ||
Changes Planned | mharbison72 | ||
Needs Revision | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Needs Revision | durin42 | ||
Changes Planned | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
try: | try: | ||||
status = dispatch(req) | status = dispatch(req) | ||||
except error.StdioError as e: | except error.StdioError as e: | ||||
err = e | err = e | ||||
status = -1 | status = -1 | ||||
# In all cases we try to flush stdio streams. | # In all cases we try to flush stdio streams. | ||||
if util.safehasattr(req.ui, b'fout'): | if util.safehasattr(req.ui, b'fout'): | ||||
assert req.ui is not None # help pytype | |||||
assert req.ui.fout is not None # help pytype | |||||
try: | try: | ||||
req.ui.fout.flush() | req.ui.fout.flush() | ||||
except IOError as e: | except IOError as e: | ||||
err = e | err = e | ||||
status = -1 | status = -1 | ||||
if util.safehasattr(req.ui, b'ferr'): | if util.safehasattr(req.ui, b'ferr'): | ||||
assert req.ui is not None # help pytype | |||||
assert req.ui.ferr is not None # help pytype | |||||
try: | try: | ||||
if err is not None and err.errno != errno.EPIPE: | if err is not None and err.errno != errno.EPIPE: | ||||
req.ui.ferr.write( | req.ui.ferr.write( | ||||
b'abort: %s\n' % encoding.strtolocal(err.strerror) | b'abort: %s\n' % encoding.strtolocal(err.strerror) | ||||
) | ) | ||||
req.ui.ferr.flush() | req.ui.ferr.flush() | ||||
# There's not much we can do about an I/O error here. So (possibly) | # There's not much we can do about an I/O error here. So (possibly) | ||||
# change the status code and move on. | # change the status code and move on. | ||||
return commands.version_(ui) | return commands.version_(ui) | ||||
if options[b'help']: | if options[b'help']: | ||||
return commands.help_(ui, cmd, command=cmd is not None) | return commands.help_(ui, cmd, command=cmd is not None) | ||||
elif not cmd: | elif not cmd: | ||||
return commands.help_(ui, b'shortlist') | return commands.help_(ui, b'shortlist') | ||||
repo = None | repo = None | ||||
cmdpats = args[:] | cmdpats = args[:] | ||||
assert func is not None # help out pytype | |||||
if not func.norepo: | if not func.norepo: | ||||
# use the repo from the request only if we don't have -R | # use the repo from the request only if we don't have -R | ||||
if not rpath and not cwd: | if not rpath and not cwd: | ||||
repo = req.repo | repo = req.repo | ||||
if repo: | if repo: | ||||
# set the descriptors of the repo ui to those of ui | # set the descriptors of the repo ui to those of ui | ||||
repo.ui.fin = ui.fin | repo.ui.fin = ui.fin |