Mercurial > public > mercurial-scm > hg-stable
diff mercurial/httppeer.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 | 7bbdb78d2842 |
children | b502138f5faa |
line wrap: on
line diff
--- a/mercurial/httppeer.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/httppeer.py Thu Oct 08 12:55:45 2015 -0700 @@ -49,7 +49,7 @@ self.requestbuilder = None u = util.url(path) if u.query or u.fragment: - raise util.Abort(_('unsupported URL component: "%s"') % + raise error.Abort(_('unsupported URL component: "%s"') % (u.query or u.fragment)) # urllib cannot handle URLs with embedded user or passwd @@ -86,7 +86,7 @@ return self.caps def lock(self): - raise util.Abort(_('operation not supported over http')) + raise error.Abort(_('operation not supported over http')) def _callstream(self, cmd, **args): if cmd == 'pushkey': @@ -137,7 +137,7 @@ resp = self.urlopener.open(req) except urllib2.HTTPError as inst: if inst.code == 401: - raise util.Abort(_('authorization failed')) + raise error.Abort(_('authorization failed')) raise except httplib.HTTPException as inst: self.ui.debug('http error while sending %s command\n' % cmd) @@ -145,7 +145,7 @@ raise IOError(None, inst) except IndexError: # this only happens with Python 2.3, later versions raise URLError - raise util.Abort(_('http error, possibly caused by proxy setting')) + raise error.Abort(_('http error, possibly caused by proxy setting')) # record the url we got redirected to resp_url = resp.geturl() if resp_url.endswith(qs): @@ -223,8 +223,8 @@ return vals except socket.error as err: if err.args[0] in (errno.ECONNRESET, errno.EPIPE): - raise util.Abort(_('push failed: %s') % err.args[1]) - raise util.Abort(err.args[1]) + raise error.Abort(_('push failed: %s') % err.args[1]) + raise error.Abort(err.args[1]) finally: fp.close() os.unlink(tempname) @@ -263,13 +263,13 @@ class httpspeer(httppeer): def __init__(self, ui, path): if not url.has_https: - raise util.Abort(_('Python support for SSL and HTTPS ' + raise error.Abort(_('Python support for SSL and HTTPS ' 'is not installed')) httppeer.__init__(self, ui, path) def instance(ui, path, create): if create: - raise util.Abort(_('cannot create new http repository')) + raise error.Abort(_('cannot create new http repository')) try: if path.startswith('https:'): inst = httpspeer(ui, path)