Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dispatch.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 | 4b0fc75f9403 |
children | 77850d2a161c |
line wrap: on
line diff
--- a/mercurial/dispatch.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/dispatch.py Thu Oct 08 12:55:45 2015 -0700 @@ -100,7 +100,7 @@ req.ui.fout = req.fout if req.ferr: req.ui.ferr = req.ferr - except util.Abort as inst: + except error.Abort as inst: ferr.write(_("abort: %s\n") % inst) if inst.hint: ferr.write(_("(%s)\n") % inst.hint) @@ -253,7 +253,7 @@ # check if the command is in a disabled extension # (but don't check for extensions themselves) commands.help_(ui, inst.args[0], unknowncmd=True) - except (error.UnknownCommand, util.Abort): + except (error.UnknownCommand, error.Abort): suggested = False if len(inst.args) == 2: sim = _getsimilar(inst.args[1], inst.args[0]) @@ -266,7 +266,7 @@ except error.InterventionRequired as inst: ui.warn("%s\n" % inst) return 1 - except util.Abort as inst: + except error.Abort as inst: ui.warn(_("abort: %s\n") % inst) if inst.hint: ui.warn(_("(%s)\n") % inst.hint) @@ -398,7 +398,7 @@ nums.append(num) if num < len(givenargs): return givenargs[num] - raise util.Abort(_('too few arguments for command alias')) + raise error.Abort(_('too few arguments for command alias')) cmd = re.sub(r'\$(\d+|\$)', replacer, cmd) givenargs = [x for i, x in enumerate(givenargs) if i not in nums] @@ -525,7 +525,7 @@ hint = _("'%s' is provided by '%s' extension") % (cmd, ext) except error.UnknownCommand: pass - raise util.Abort(self.badalias, hint=hint) + raise error.Abort(self.badalias, hint=hint) if self.shadows: ui.debug("alias '%s' shadows command '%s'\n" % (self.name, self.cmdname)) @@ -614,7 +614,7 @@ ui.setconfig(section, name, value, '--config') configs.append((section, name, value)) except (IndexError, ValueError): - raise util.Abort(_('malformed --config option: %r ' + raise error.Abort(_('malformed --config option: %r ' '(use --config section.name=value)') % cfg) return configs @@ -690,7 +690,7 @@ try: wd = os.getcwd() except OSError as e: - raise util.Abort(_("error getting current working directory: %s") % + raise error.Abort(_("error getting current working directory: %s") % e.strerror) path = cmdutil.findrepo(wd) or "" if not path: @@ -813,11 +813,11 @@ cmd, func, args, options, cmdoptions = _parse(lui, args) if options["config"]: - raise util.Abort(_("option --config may not be abbreviated!")) + raise error.Abort(_("option --config may not be abbreviated!")) if options["cwd"]: - raise util.Abort(_("option --cwd may not be abbreviated!")) + raise error.Abort(_("option --cwd may not be abbreviated!")) if options["repository"]: - raise util.Abort(_( + raise error.Abort(_( "option -R has to be separated from other options (e.g. not -qR) " "and --repository may only be abbreviated as --repo!")) @@ -884,7 +884,7 @@ try: repo = hg.repository(ui, path=path) if not repo.local(): - raise util.Abort(_("repository '%s' is not local") % path) + raise error.Abort(_("repository '%s' is not local") % path) repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo') except error.RequirementError: raise @@ -936,7 +936,7 @@ try: from . import lsprof except ImportError: - raise util.Abort(_( + raise error.Abort(_( 'lsprof not available - install from ' 'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) p = lsprof.Profiler() @@ -960,7 +960,7 @@ try: from flamegraph import flamegraph except ImportError: - raise util.Abort(_( + raise error.Abort(_( 'flamegraph not available - install from ' 'https://github.com/evanhempel/python-flamegraph')) # developer config: profiling.freq @@ -985,7 +985,7 @@ try: import statprof except ImportError: - raise util.Abort(_( + raise error.Abort(_( 'statprof not available - install using "easy_install statprof"')) freq = ui.configint('profiling', 'freq', default=1000)