Mercurial > hg-stable
changeset 18263:9aa6bee6e9f9
subrepo: add subrepo property to SubrepoAbort exceptions
This new property contains the path of the subrepo that generated the exception.
This information can then be used by GUI tools such as TortoiseHg.
author | Angel Ezquerra <angel.ezquerra@gmail.com> |
---|---|
date | Thu, 03 Jan 2013 17:35:58 +0100 |
parents | ed923a2d5ae9 |
children | d6ebdbdd70a5 |
files | mercurial/subrepo.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Tue Jan 08 15:43:48 2013 -0800 +++ b/mercurial/subrepo.py Thu Jan 03 17:35:58 2013 +0100 @@ -16,6 +16,9 @@ class SubrepoAbort(error.Abort): """Exception class used to avoid handling a subrepo error more than once""" + def __init__(self, *args, **kw): + super(SubrepoAbort, self).__init__(*args, **kw) + self.subrepo = kw.get('subrepo') def annotatesubrepoerror(func): def decoratedmethod(self, *args, **kargs): @@ -25,9 +28,10 @@ # This exception has already been handled raise ex except error.Abort, ex: - errormsg = _('%s (in subrepo %s)') % (str(ex), subrelpath(self)) + subrepo = subrelpath(self) + errormsg = _('%s (in subrepo %s)') % (str(ex), subrepo) # avoid handling this exception by raising a SubrepoAbort exception - raise SubrepoAbort(errormsg, hint=ex.hint) + raise SubrepoAbort(errormsg, hint=ex.hint, subrepo=subrepo) return res return decoratedmethod