Mercurial > public > mercurial-scm > hg-stable
diff hgext/acl.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 | dd166d42e7b2 |
children | a1163ee26e4a |
line wrap: on
line diff
--- a/hgext/acl.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/acl.py Thu Oct 08 12:55:45 2015 -0700 @@ -192,7 +192,7 @@ ''' from mercurial.i18n import _ -from mercurial import util, match +from mercurial import util, match, error import getpass, urllib # Note for extension authors: ONLY specify testedwith = 'internal' for @@ -213,7 +213,7 @@ try: return util.groupmembers(group) except KeyError: - raise util.Abort(_("group '%s' is undefined") % group) + raise error.Abort(_("group '%s' is undefined") % group) def _usermatch(ui, user, usersorgroups): @@ -268,7 +268,7 @@ def hook(ui, repo, hooktype, node=None, source=None, **kwargs): if hooktype not in ['pretxnchangegroup', 'pretxncommit']: - raise util.Abort(_('config error - hook type "%s" cannot stop ' + raise error.Abort(_('config error - hook type "%s" cannot stop ' 'incoming changesets nor commits') % hooktype) if (hooktype == 'pretxnchangegroup' and source not in ui.config('acl', 'sources', 'serve').split()): @@ -301,11 +301,11 @@ ctx = repo[rev] branch = ctx.branch() if denybranches and denybranches(branch): - raise util.Abort(_('acl: user "%s" denied on branch "%s"' + raise error.Abort(_('acl: user "%s" denied on branch "%s"' ' (changeset "%s")') % (user, branch, ctx)) if allowbranches and not allowbranches(branch): - raise util.Abort(_('acl: user "%s" not allowed on branch "%s"' + raise error.Abort(_('acl: user "%s" not allowed on branch "%s"' ' (changeset "%s")') % (user, branch, ctx)) ui.debug('acl: branch access granted: "%s" on branch "%s"\n' @@ -313,9 +313,9 @@ for f in ctx.files(): if deny and deny(f): - raise util.Abort(_('acl: user "%s" denied on "%s"' + raise error.Abort(_('acl: user "%s" denied on "%s"' ' (changeset "%s")') % (user, f, ctx)) if allow and not allow(f): - raise util.Abort(_('acl: user "%s" not allowed on "%s"' + raise error.Abort(_('acl: user "%s" not allowed on "%s"' ' (changeset "%s")') % (user, f, ctx)) ui.debug('acl: path access granted: "%s"\n' % ctx)