Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hook.py @ 26587:56b2bcea2529
error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.
For great justice.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 08 Oct 2015 12:55:45 -0700 |
parents | d15b279ddade |
children | 8d1cfd77b64f |
line wrap: on
line diff
--- a/mercurial/hook.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/hook.py Thu Oct 08 12:55:45 2015 -0700 @@ -35,7 +35,7 @@ else: d = funcname.rfind('.') if d == -1: - raise util.Abort(_('%s hook is invalid ("%s" not in ' + raise error.Abort(_('%s hook is invalid ("%s" not in ' 'a module)') % (hname, funcname)) modname = funcname[:d] oldpaths = sys.path @@ -63,7 +63,7 @@ ui.warn(_('exception from second failed import ' 'attempt:\n')) ui.traceback(e2) - raise util.Abort(_('%s hook is invalid ' + raise error.Abort(_('%s hook is invalid ' '(import of "%s" failed)') % (hname, modname)) sys.path = oldpaths @@ -71,11 +71,11 @@ for p in funcname.split('.')[1:]: obj = getattr(obj, p) except AttributeError: - raise util.Abort(_('%s hook is invalid ' + raise error.Abort(_('%s hook is invalid ' '("%s" is not defined)') % (hname, funcname)) if not callable(obj): - raise util.Abort(_('%s hook is invalid ' + raise error.Abort(_('%s hook is invalid ' '("%s" is not callable)') % (hname, funcname)) @@ -91,7 +91,7 @@ r = obj(ui=ui, repo=repo, hooktype=name, **args) except Exception as exc: - if isinstance(exc, util.Abort): + if isinstance(exc, error.Abort): ui.warn(_('error: %s hook failed: %s\n') % (hname, exc.args[0])) else: