Mercurial > hg
changeset 25242:8de7d1d937b3
error: allow a 'hint' to OutOfBandError
This will be useful when changing the behavior of OutOfBandError for ssh in the
next changeset.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 20 May 2015 18:17:40 -0500 |
parents | aa36204766e4 |
children | d65243d28749 |
files | mercurial/dispatch.py mercurial/error.py |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Thu May 21 14:30:22 2015 -0500 +++ b/mercurial/dispatch.py Wed May 20 18:17:40 2015 -0500 @@ -193,8 +193,15 @@ ui.warn(_("hg: %s\n") % inst.args[1]) commands.help_(ui, 'shortlist') except error.OutOfBandError, inst: - ui.warn(_("abort: remote error:\n")) - ui.warn(''.join(inst.args)) + if inst.args: + msg = _("abort: remote error:\n") + else: + msg = _("abort: remote error\n") + ui.warn(msg) + if inst.args: + ui.warn(''.join(inst.args)) + if inst.hint: + ui.warn('(%s)\n' % inst.hint) except error.RepoError, inst: ui.warn(_("abort: %s!\n") % inst) if inst.hint:
--- a/mercurial/error.py Thu May 21 14:30:22 2015 -0500 +++ b/mercurial/error.py Wed May 20 18:17:40 2015 -0500 @@ -64,6 +64,10 @@ class OutOfBandError(Exception): """Exception raised when a remote repo reports failure""" + def __init__(self, *args, **kw): + Exception.__init__(self, *args) + self.hint = kw.get('hint') + class ParseError(Exception): """Raised when parsing config files and {rev,file}sets (msg[, pos])"""