Mercurial > hg-stable
changeset 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.
line wrap: on
line diff
--- a/contrib/simplemerge Mon Oct 05 22:49:24 2015 -0700 +++ b/contrib/simplemerge Thu Oct 08 12:55:45 2015 -0700 @@ -5,7 +5,7 @@ import sys from mercurial.i18n import _ -from mercurial import simplemerge, fancyopts, util, ui +from mercurial import error, simplemerge, fancyopts, util, ui options = [('L', 'label', [], _('labels to use on conflict markers')), ('a', 'text', None, _('treat all files as text')), @@ -59,7 +59,7 @@ sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) showhelp() sys.exit(1) -except util.Abort, e: +except error.Abort, e: sys.stderr.write("abort: %s\n" % e) sys.exit(255) except KeyboardInterrupt:
--- a/contrib/synthrepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/contrib/synthrepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -37,7 +37,7 @@ ''' import bisect, collections, itertools, json, os, random, time, sys -from mercurial import cmdutil, context, patch, scmutil, util, hg +from mercurial import cmdutil, context, patch, scmutil, util, hg, error from mercurial.i18n import _ from mercurial.node import nullrev, nullid, short @@ -254,7 +254,7 @@ try: fp = hg.openpath(ui, descpath) except Exception as err: - raise util.Abort('%s: %s' % (descpath, err[0].strerror)) + raise error.Abort('%s: %s' % (descpath, err[0].strerror)) desc = json.load(fp) fp.close() @@ -286,7 +286,7 @@ try: fp = open(dictfile, 'rU') except IOError as err: - raise util.Abort('%s: %s' % (dictfile, err.strerror)) + raise error.Abort('%s: %s' % (dictfile, err.strerror)) words = fp.read().splitlines() fp.close()
--- 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)
--- a/hgext/bugzilla.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/bugzilla.py Thu Oct 08 12:55:45 2015 -0700 @@ -279,7 +279,7 @@ from mercurial.i18n import _ from mercurial.node import short -from mercurial import cmdutil, mail, util +from mercurial import cmdutil, mail, util, error import re, time, urlparse, xmlrpclib # Note for extension authors: ONLY specify testedwith = 'internal' for @@ -358,7 +358,7 @@ import MySQLdb as mysql bzmysql._MySQLdb = mysql except ImportError as err: - raise util.Abort(_('python mysql support not available: %s') % err) + raise error.Abort(_('python mysql support not available: %s') % err) bzaccess.__init__(self, ui) @@ -392,7 +392,7 @@ self.run('select fieldid from fielddefs where name = "longdesc"') ids = self.cursor.fetchall() if len(ids) != 1: - raise util.Abort(_('unknown database schema')) + raise error.Abort(_('unknown database schema')) return ids[0][0] def filter_real_bug_ids(self, bugs): @@ -437,7 +437,7 @@ ret = fp.close() if ret: self.ui.warn(out) - raise util.Abort(_('bugzilla notify command %s') % + raise error.Abort(_('bugzilla notify command %s') % util.explainexit(ret)[0]) self.ui.status(_('done\n')) @@ -470,12 +470,12 @@ try: defaultuser = self.ui.config('bugzilla', 'bzuser') if not defaultuser: - raise util.Abort(_('cannot find bugzilla user id for %s') % + raise error.Abort(_('cannot find bugzilla user id for %s') % user) userid = self.get_user_id(defaultuser) user = defaultuser except KeyError: - raise util.Abort(_('cannot find bugzilla user id for %s or %s') + raise error.Abort(_('cannot find bugzilla user id for %s or %s') % (user, defaultuser)) return (user, userid) @@ -517,7 +517,7 @@ self.run('select id from fielddefs where name = "longdesc"') ids = self.cursor.fetchall() if len(ids) != 1: - raise util.Abort(_('unknown database schema')) + raise error.Abort(_('unknown database schema')) return ids[0][0] # Bugzilla via XMLRPC interface. @@ -705,7 +705,7 @@ self.bzemail = self.ui.config('bugzilla', 'bzemail') if not self.bzemail: - raise util.Abort(_("configuration 'bzemail' missing")) + raise error.Abort(_("configuration 'bzemail' missing")) mail.validateconfig(self.ui) def makecommandline(self, fieldname, value): @@ -735,8 +735,8 @@ matches = self.bzproxy.User.get({'match': [user], 'token': self.bztoken}) if not matches['users']: - raise util.Abort(_("default bugzilla user %s email not found") % - user) + raise error.Abort(_("default bugzilla user %s email not found") + % user) user = matches['users'][0]['email'] commands.append(self.makecommandline("id", bugid)) @@ -789,7 +789,7 @@ try: bzclass = bugzilla._versions[bzversion] except KeyError: - raise util.Abort(_('bugzilla version %s not supported') % + raise error.Abort(_('bugzilla version %s not supported') % bzversion) self.bzdriver = bzclass(self.ui) @@ -900,7 +900,7 @@ bugzilla bug id. only add a comment once per bug, so same change seen multiple times does not fill bug with duplicate data.''' if node is None: - raise util.Abort(_('hook type %s does not pass a changeset id') % + raise error.Abort(_('hook type %s does not pass a changeset id') % hooktype) try: bz = bugzilla(ui, repo) @@ -911,4 +911,4 @@ bz.update(bug, bugs[bug], ctx) bz.notify(bugs, util.email(ctx.user())) except Exception as e: - raise util.Abort(_('Bugzilla error: %s') % e) + raise error.Abort(_('Bugzilla error: %s') % e)
--- a/hgext/censor.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/censor.py Thu Oct 08 12:55:45 2015 -0700 @@ -43,47 +43,47 @@ _('-r REV [-t TEXT] [FILE]')) def censor(ui, repo, path, rev='', tombstone='', **opts): if not path: - raise util.Abort(_('must specify file path to censor')) + raise error.Abort(_('must specify file path to censor')) if not rev: - raise util.Abort(_('must specify revision to censor')) + raise error.Abort(_('must specify revision to censor')) wctx = repo[None] m = scmutil.match(wctx, (path,)) if m.anypats() or len(m.files()) != 1: - raise util.Abort(_('can only specify an explicit filename')) + raise error.Abort(_('can only specify an explicit filename')) path = m.files()[0] flog = repo.file(path) if not len(flog): - raise util.Abort(_('cannot censor file with no history')) + raise error.Abort(_('cannot censor file with no history')) rev = scmutil.revsingle(repo, rev, rev).rev() try: ctx = repo[rev] except KeyError: - raise util.Abort(_('invalid revision identifier %s') % rev) + raise error.Abort(_('invalid revision identifier %s') % rev) try: fctx = ctx.filectx(path) except error.LookupError: - raise util.Abort(_('file does not exist at revision %s') % rev) + raise error.Abort(_('file does not exist at revision %s') % rev) fnode = fctx.filenode() headctxs = [repo[c] for c in repo.heads()] heads = [c for c in headctxs if path in c and c.filenode(path) == fnode] if heads: headlist = ', '.join([short(c.node()) for c in heads]) - raise util.Abort(_('cannot censor file in heads (%s)') % headlist, + raise error.Abort(_('cannot censor file in heads (%s)') % headlist, hint=_('clean/delete and commit first')) wp = wctx.parents() if ctx.node() in [p.node() for p in wp]: - raise util.Abort(_('cannot censor working directory'), + raise error.Abort(_('cannot censor working directory'), hint=_('clean/delete/update first')) flogv = flog.version & 0xFFFF if flogv != revlog.REVLOGNG: - raise util.Abort( + raise error.Abort( _('censor does not support revlog version %d') % (flogv,)) tombstone = filelog.packmeta({"censored": tombstone}, "") @@ -91,7 +91,7 @@ crev = fctx.filerev() if len(tombstone) > flog.rawsize(crev): - raise util.Abort(_( + raise error.Abort(_( 'censor tombstone must be no longer than censored data')) # Using two files instead of one makes it easy to rewrite entry-by-entry
--- a/hgext/churn.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/churn.py Thu Oct 08 12:55:45 2015 -0700 @@ -9,7 +9,7 @@ '''command to display statistics about repository history''' from mercurial.i18n import _ -from mercurial import patch, cmdutil, scmutil, util, commands +from mercurial import patch, cmdutil, scmutil, util, commands, error from mercurial import encoding import os import time, datetime @@ -27,7 +27,7 @@ t = cmdutil.changeset_templater(ui, repo, False, None, tmpl, None, False) except SyntaxError as inst: - raise util.Abort(inst.args[0]) + raise error.Abort(inst.args[0]) return t def changedlines(ui, repo, ctx1, ctx2, fns):
--- a/hgext/convert/bzr.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/bzr.py Thu Oct 08 12:55:45 2015 -0700 @@ -9,7 +9,7 @@ # it cannot access 'bar' repositories, but they were never used very much import os -from mercurial import demandimport +from mercurial import demandimport, error # these do not work with demandimport, blacklist demandimport.ignore.extend([ 'bzrlib.transactions', @@ -18,7 +18,7 @@ ]) from mercurial.i18n import _ -from mercurial import util +from mercurial import error from common import NoRepo, commit, converter_source try: @@ -108,7 +108,8 @@ pass revid = info.rev_id if revid is None: - raise util.Abort(_('%s is not a valid revision') % self.revs[0]) + raise error.Abort(_('%s is not a valid revision') + % self.revs[0]) heads = [revid] # Empty repositories return 'null:', which cannot be retrieved heads = [h for h in heads if h != 'null:'] @@ -127,7 +128,7 @@ if kind == 'symlink': target = revtree.get_symlink_target(fileid) if target is None: - raise util.Abort(_('%s.%s symlink has no target') + raise error.Abort(_('%s.%s symlink has no target') % (name, rev)) return target, mode else: @@ -136,7 +137,7 @@ def getchanges(self, version, full): if full: - raise util.Abort(_("convert from cvs do not support --full")) + raise error.Abort(_("convert from cvs do not support --full")) self._modecache = {} self._revtree = self.sourcerepo.revision_tree(version) # get the parentids from the cache
--- a/hgext/convert/common.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/common.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ import base64, errno, subprocess, os, datetime, re import cPickle as pickle -from mercurial import phases, util +from mercurial import phases, util, error from mercurial.i18n import _ propertycache = util.propertycache @@ -32,7 +32,7 @@ name = name or exe if not util.findexe(exe): if abort: - exc = util.Abort + exc = error.Abort else: exc = MissingTool raise exc(_('cannot find required "%s" tool') % name) @@ -73,7 +73,7 @@ such format for their revision numbering """ if not re.match(r'[0-9a-fA-F]{40,40}$', revstr): - raise util.Abort(_('%s entry %s is not a valid revision' + raise error.Abort(_('%s entry %s is not a valid revision' ' identifier') % (mapname, revstr)) def before(self): @@ -369,7 +369,7 @@ self.ui.warn(_('%s error:\n') % self.command) self.ui.warn(output) msg = util.explainexit(status)[0] - raise util.Abort('%s %s' % (self.command, msg)) + raise error.Abort('%s %s' % (self.command, msg)) def run0(self, cmd, *args, **kwargs): output, status = self.run(cmd, *args, **kwargs) @@ -446,7 +446,7 @@ try: key, value = line.rsplit(' ', 1) except ValueError: - raise util.Abort( + raise error.Abort( _('syntax error in %s(%d): key/value pair expected') % (self.path, i + 1)) if key not in self: @@ -459,7 +459,7 @@ try: self.fp = open(self.path, 'a') except IOError as err: - raise util.Abort(_('could not open map file %r: %s') % + raise error.Abort(_('could not open map file %r: %s') % (self.path, err.strerror)) self.fp.write('%s %s\n' % (key, value)) self.fp.flush()
--- a/hgext/convert/convcmd.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/convcmd.py Thu Oct 08 12:55:45 2015 -0700 @@ -18,7 +18,7 @@ import filemap import os, shutil, shlex -from mercurial import hg, util, encoding +from mercurial import hg, util, encoding, error from mercurial.i18n import _ orig_encoding = 'ascii' @@ -82,7 +82,7 @@ def convertsource(ui, path, type, revs): exceptions = [] if type and type not in [s[0] for s in source_converters]: - raise util.Abort(_('%s: invalid source repository type') % type) + raise error.Abort(_('%s: invalid source repository type') % type) for name, source, sortmode in source_converters: try: if not type or name == type: @@ -92,11 +92,11 @@ if not ui.quiet: for inst in exceptions: ui.write("%s\n" % inst) - raise util.Abort(_('%s: missing or unsupported repository') % path) + raise error.Abort(_('%s: missing or unsupported repository') % path) def convertsink(ui, path, type): if type and type not in [s[0] for s in sink_converters]: - raise util.Abort(_('%s: invalid destination repository type') % type) + raise error.Abort(_('%s: invalid destination repository type') % type) for name, sink in sink_converters: try: if not type or name == type: @@ -104,8 +104,8 @@ except NoRepo as inst: ui.note(_("convert: %s\n") % inst) except MissingTool as inst: - raise util.Abort('%s\n' % inst) - raise util.Abort(_('%s: unknown repository type') % path) + raise error.Abort('%s\n' % inst) + raise error.Abort(_('%s: unknown repository type') % path) class progresssource(object): def __init__(self, ui, source, filecount): @@ -185,7 +185,7 @@ line = list(lex) # check number of parents if not (2 <= len(line) <= 3): - raise util.Abort(_('syntax error in %s(%d): child parent1' + raise error.Abort(_('syntax error in %s(%d): child parent1' '[,parent2] expected') % (path, i + 1)) for part in line: self.source.checkrevformat(part) @@ -196,7 +196,7 @@ m[child] = p1 + p2 # if file does not exist or error reading, exit except IOError: - raise util.Abort(_('splicemap file not found or error reading %s:') + raise error.Abort(_('splicemap file not found or error reading %s:') % path) return m @@ -247,7 +247,7 @@ continue # Parent is not in dest and not being converted, not good if p not in parents: - raise util.Abort(_('unknown splice map parent: %s') % p) + raise error.Abort(_('unknown splice map parent: %s') % p) pc.append(p) parents[c] = pc @@ -343,7 +343,7 @@ elif sortmode == 'closesort': picknext = makeclosesorter() else: - raise util.Abort(_('unknown sort mode: %s') % sortmode) + raise error.Abort(_('unknown sort mode: %s') % sortmode) children, actives = mapchildren(parents) @@ -361,7 +361,7 @@ try: pendings[c].remove(n) except ValueError: - raise util.Abort(_('cycle detected between %s and %s') + raise error.Abort(_('cycle detected between %s and %s') % (recode(c), recode(n))) if not pendings[c]: # Parents are converted, node is eligible @@ -369,7 +369,7 @@ pendings[c] = None if len(s) != len(parents): - raise util.Abort(_("not all revisions were sorted")) + raise error.Abort(_("not all revisions were sorted")) return s @@ -556,16 +556,17 @@ sortmodes = ('branchsort', 'datesort', 'sourcesort', 'closesort') sortmode = [m for m in sortmodes if opts.get(m)] if len(sortmode) > 1: - raise util.Abort(_('more than one sort mode specified')) + raise error.Abort(_('more than one sort mode specified')) if sortmode: sortmode = sortmode[0] else: sortmode = defaultsort if sortmode == 'sourcesort' and not srcc.hasnativeorder(): - raise util.Abort(_('--sourcesort is not supported by this data source')) + raise error.Abort(_('--sourcesort is not supported by this data source') + ) if sortmode == 'closesort' and not srcc.hasnativeclose(): - raise util.Abort(_('--closesort is not supported by this data source')) + raise error.Abort(_('--closesort is not supported by this data source')) fmap = opts.get('filemap') if fmap:
--- a/hgext/convert/cvs.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/cvs.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ import os, re, socket, errno from cStringIO import StringIO -from mercurial import encoding, util +from mercurial import encoding, util, error from mercurial.i18n import _ from common import NoRepo, commit, converter_source, checktool @@ -43,14 +43,14 @@ maxrev = 0 if self.revs: if len(self.revs) > 1: - raise util.Abort(_('cvs source does not support specifying ' + raise error.Abort(_('cvs source does not support specifying ' 'multiple revs')) # TODO: handle tags try: # patchset number? maxrev = int(self.revs[0]) except ValueError: - raise util.Abort(_('revision %s is not a patchset number') + raise error.Abort(_('revision %s is not a patchset number') % self.revs[0]) d = os.getcwd() @@ -150,7 +150,7 @@ sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw, "END AUTH REQUEST", ""])) if sck.recv(128) != "I LOVE YOU\n": - raise util.Abort(_("CVS pserver authentication failed")) + raise error.Abort(_("CVS pserver authentication failed")) self.writep = self.readp = sck.makefile('r+') @@ -193,7 +193,7 @@ self.writep.flush() r = self.readp.readline() if not r.startswith("Valid-requests"): - raise util.Abort(_('unexpected response from CVS server ' + raise error.Abort(_('unexpected response from CVS server ' '(expected "Valid-requests", but got %r)') % r) if "UseUnchanged" in r: @@ -215,7 +215,7 @@ while count > 0: data = fp.read(min(count, chunksize)) if not data: - raise util.Abort(_("%d bytes missing from remote file") + raise error.Abort(_("%d bytes missing from remote file") % count) count -= len(data) output.write(data) @@ -252,18 +252,18 @@ else: if line == "ok\n": if mode is None: - raise util.Abort(_('malformed response from CVS')) + raise error.Abort(_('malformed response from CVS')) return (data, "x" in mode and "x" or "") elif line.startswith("E "): self.ui.warn(_("cvs server: %s\n") % line[2:]) elif line.startswith("Remove"): self.readp.readline() else: - raise util.Abort(_("unknown CVS response: %s") % line) + raise error.Abort(_("unknown CVS response: %s") % line) def getchanges(self, rev, full): if full: - raise util.Abort(_("convert from cvs do not support --full")) + raise error.Abort(_("convert from cvs do not support --full")) self._parse() return sorted(self.files[rev].iteritems()), {}, set()
--- a/hgext/convert/darcs.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/darcs.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ from common import NoRepo, checktool, commandline, commit, converter_source from mercurial.i18n import _ -from mercurial import util +from mercurial import util, error import os, shutil, tempfile, re, errno # The naming drift of ElementTree is fun! @@ -39,11 +39,11 @@ checktool('darcs') version = self.run0('--version').splitlines()[0].strip() if version < '2.1': - raise util.Abort(_('darcs version 2.1 or newer needed (found %r)') % - version) + raise error.Abort(_('darcs version 2.1 or newer needed (found %r)') + % version) if "ElementTree" not in globals(): - raise util.Abort(_("Python ElementTree module is not available")) + raise error.Abort(_("Python ElementTree module is not available")) self.path = os.path.realpath(path) @@ -158,7 +158,7 @@ def getchanges(self, rev, full): if full: - raise util.Abort(_("convert from darcs do not support --full")) + raise error.Abort(_("convert from darcs do not support --full")) copies = {} changes = [] man = None @@ -192,7 +192,7 @@ def getfile(self, name, rev): if rev != self.lastrev: - raise util.Abort(_('internal calling inconsistency')) + raise error.Abort(_('internal calling inconsistency')) path = os.path.join(self.tmppath, name) try: data = util.readfile(path)
--- a/hgext/convert/filemap.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/filemap.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ import posixpath import shlex from mercurial.i18n import _ -from mercurial import util, error +from mercurial import error from common import SKIPREV, converter_source def rpairs(path): @@ -45,7 +45,7 @@ self.targetprefixes = None if path: if self.parse(path): - raise util.Abort(_('errors in filemap')) + raise error.Abort(_('errors in filemap')) def parse(self, path): errs = 0 @@ -291,7 +291,7 @@ try: files = self.base.getchangedfiles(rev, i) except NotImplementedError: - raise util.Abort(_("source repository doesn't support --filemap")) + raise error.Abort(_("source repository doesn't support --filemap")) for f in files: if self.filemapper(f): return True
--- a/hgext/convert/git.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/git.py Thu Oct 08 12:55:45 2015 -0700 @@ -97,7 +97,7 @@ # The default value (50) is based on the default for 'git diff'. similarity = ui.configint('convert', 'git.similarity', default=50) if similarity < 0 or similarity > 100: - raise util.Abort(_('similarity must be between 0 and 100')) + raise error.Abort(_('similarity must be between 0 and 100')) if similarity > 0: self.simopt = '-C%d%%' % similarity findcopiesharder = ui.configbool('convert', 'git.findcopiesharder', @@ -123,14 +123,14 @@ heads, ret = self.gitread('git rev-parse --branches --remotes') heads = heads.splitlines() if ret: - raise util.Abort(_('cannot retrieve git heads')) + raise error.Abort(_('cannot retrieve git heads')) else: heads = [] for rev in self.revs: rawhead, ret = self.gitread("git rev-parse --verify %s" % rev) heads.append(rawhead[:-1]) if ret: - raise util.Abort(_('cannot retrieve git head "%s"') % rev) + raise error.Abort(_('cannot retrieve git head "%s"') % rev) return heads def catfile(self, rev, type): @@ -140,11 +140,11 @@ self.catfilepipe[0].flush() info = self.catfilepipe[1].readline().split() if info[1] != type: - raise util.Abort(_('cannot read %r object at %s') % (type, rev)) + raise error.Abort(_('cannot read %r object at %s') % (type, rev)) size = int(info[2]) data = self.catfilepipe[1].read(size) if len(data) < size: - raise util.Abort(_('cannot read %r object at %s: unexpected size') + raise error.Abort(_('cannot read %r object at %s: unexpected size') % (type, rev)) # read the trailing newline self.catfilepipe[1].read(1) @@ -210,7 +210,7 @@ def getchanges(self, version, full): if full: - raise util.Abort(_("convert from git do not support --full")) + raise error.Abort(_("convert from git do not support --full")) self.modecache = {} fh = self.gitopen("git diff-tree -z --root -m -r %s %s" % ( self.simopt, version)) @@ -283,7 +283,7 @@ copies[fdest] = f entry = None if fh.close(): - raise util.Abort(_('cannot read changes in %s') % version) + raise error.Abort(_('cannot read changes in %s') % version) if subexists[0]: if subdeleted[0]: @@ -342,13 +342,13 @@ for line in fh: line = line.strip() if line.startswith("error:") or line.startswith("fatal:"): - raise util.Abort(_('cannot read tags from %s') % self.path) + raise error.Abort(_('cannot read tags from %s') % self.path) node, tag = line.split(None, 1) if not tag.startswith(prefix): continue alltags[tag[len(prefix):]] = node if fh.close(): - raise util.Abort(_('cannot read tags from %s') % self.path) + raise error.Abort(_('cannot read tags from %s') % self.path) # Filter out tag objects for annotated tag refs for tag in alltags: @@ -376,7 +376,7 @@ '"%s^%s" --' % (version, version, i + 1)) changes = [f.rstrip('\n') for f in fh] if fh.close(): - raise util.Abort(_('cannot read changes in %s') % version) + raise error.Abort(_('cannot read changes in %s') % version) return changes
--- a/hgext/convert/gnuarch.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/gnuarch.py Thu Oct 08 12:55:45 2015 -0700 @@ -8,7 +8,7 @@ from common import NoRepo, commandline, commit, converter_source from mercurial.i18n import _ -from mercurial import encoding, util +from mercurial import encoding, util, error import os, shutil, tempfile, stat from email.Parser import Parser @@ -42,7 +42,7 @@ if util.findexe('tla'): self.execmd = 'tla' else: - raise util.Abort(_('cannot find a GNU Arch tool')) + raise error.Abort(_('cannot find a GNU Arch tool')) commandline.__init__(self, ui, self.execmd) @@ -135,7 +135,7 @@ def getfile(self, name, rev): if rev != self.lastrev: - raise util.Abort(_('internal calling inconsistency')) + raise error.Abort(_('internal calling inconsistency')) if not os.path.lexists(os.path.join(self.tmppath, name)): return None, None @@ -144,7 +144,7 @@ def getchanges(self, rev, full): if full: - raise util.Abort(_("convert from arch do not support --full")) + raise error.Abort(_("convert from arch do not support --full")) self._update(rev) changes = [] copies = {} @@ -287,7 +287,7 @@ self.changes[rev].continuationof = self.recode( catlog['Continuation-of']) except Exception: - raise util.Abort(_('could not parse cat-log of %s') % rev) + raise error.Abort(_('could not parse cat-log of %s') % rev) def _parsechangeset(self, data, rev): for l in data:
--- a/hgext/convert/hg.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/hg.py Thu Oct 08 12:55:45 2015 -0700 @@ -205,7 +205,7 @@ # If the file requires actual merging, abort. We don't have enough # context to resolve merges correctly. if action in ['m', 'dm', 'cd', 'dc']: - raise util.Abort(_("unable to convert merge commit " + raise error.Abort(_("unable to convert merge commit " "since target parents do not merge cleanly (file " "%s, parents %s and %s)") % (file, p1ctx, p2ctx)) @@ -423,7 +423,7 @@ def hascommitforsplicemap(self, rev): if rev not in self.repo and self.clonebranches: - raise util.Abort(_('revision %s not found in destination ' + raise error.Abort(_('revision %s not found in destination ' 'repository (lookups with clonebranches=true ' 'are not implemented)') % rev) return rev in self.repo @@ -455,7 +455,7 @@ try: startnode = self.repo.lookup(startnode) except error.RepoError: - raise util.Abort(_('%s is not a valid start revision') + raise error.Abort(_('%s is not a valid start revision') % startnode) startrev = self.repo.changelog.rev(startnode) children = {startnode: 1} @@ -470,7 +470,7 @@ self._heads = self.repo.heads() else: if revs or startnode is not None: - raise util.Abort(_('hg.revs cannot be combined with ' + raise error.Abort(_('hg.revs cannot be combined with ' 'hg.startrev or --rev')) nodes = set() parents = set()
--- a/hgext/convert/monotone.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/monotone.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ # GNU General Public License version 2 or any later version. import os, re -from mercurial import util +from mercurial import util, error from common import NoRepo, commit, converter_source, checktool from common import commandline from mercurial.i18n import _ @@ -16,7 +16,7 @@ def __init__(self, ui, path=None, revs=None): converter_source.__init__(self, ui, path, revs) if revs and len(revs) > 1: - raise util.Abort(_('monotone source does not support specifying ' + raise error.Abort(_('monotone source does not support specifying ' 'multiple revs')) commandline.__init__(self, ui, 'mtn') @@ -110,34 +110,34 @@ while read != ':': read = self.mtnreadfp.read(1) if not read: - raise util.Abort(_('bad mtn packet - no end of commandnbr')) + raise error.Abort(_('bad mtn packet - no end of commandnbr')) commandnbr += read commandnbr = commandnbr[:-1] stream = self.mtnreadfp.read(1) if stream not in 'mewptl': - raise util.Abort(_('bad mtn packet - bad stream type %s') % stream) + raise error.Abort(_('bad mtn packet - bad stream type %s') % stream) read = self.mtnreadfp.read(1) if read != ':': - raise util.Abort(_('bad mtn packet - no divider before size')) + raise error.Abort(_('bad mtn packet - no divider before size')) read = None lengthstr = '' while read != ':': read = self.mtnreadfp.read(1) if not read: - raise util.Abort(_('bad mtn packet - no end of packet size')) + raise error.Abort(_('bad mtn packet - no end of packet size')) lengthstr += read try: length = long(lengthstr[:-1]) except TypeError: - raise util.Abort(_('bad mtn packet - bad packet size %s') + raise error.Abort(_('bad mtn packet - bad packet size %s') % lengthstr) read = self.mtnreadfp.read(length) if len(read) != length: - raise util.Abort(_("bad mtn packet - unable to read full packet " + raise error.Abort(_("bad mtn packet - unable to read full packet " "read %s of %s") % (len(read), length)) return (commandnbr, stream, length, read) @@ -152,7 +152,7 @@ if stream == 'l': # End of command if output != '0': - raise util.Abort(_("mtn command '%s' returned %s") % + raise error.Abort(_("mtn command '%s' returned %s") % (command, output)) break elif stream in 'ew': @@ -229,7 +229,7 @@ def getchanges(self, rev, full): if full: - raise util.Abort(_("convert from monotone do not support --full")) + raise error.Abort(_("convert from monotone do not support --full")) revision = self.mtnrun("get_revision", rev).split("\n\n") files = {} ignoremove = {} @@ -330,7 +330,7 @@ versionstr = self.mtnrunsingle("interface_version") version = float(versionstr) except Exception: - raise util.Abort(_("unable to determine mtn automate interface " + raise error.Abort(_("unable to determine mtn automate interface " "version")) if version >= 12.0: @@ -344,12 +344,12 @@ # read the headers read = self.mtnreadfp.readline() if read != 'format-version: 2\n': - raise util.Abort(_('mtn automate stdio header unexpected: %s') + raise error.Abort(_('mtn automate stdio header unexpected: %s') % read) while read != '\n': read = self.mtnreadfp.readline() if not read: - raise util.Abort(_("failed to reach end of mtn automate " + raise error.Abort(_("failed to reach end of mtn automate " "stdio headers")) else: self.ui.debug("mtn automate version %s - not using automate stdio "
--- a/hgext/convert/p4.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/p4.py Thu Oct 08 12:55:45 2015 -0700 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -from mercurial import util +from mercurial import util, error from mercurial.i18n import _ from common import commit, converter_source, checktool, NoRepo @@ -70,7 +70,7 @@ self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") if revs and len(revs) > 1: - raise util.Abort(_("p4 source does not support specifying " + raise error.Abort(_("p4 source does not support specifying " "multiple revisions")) self._parse(ui, path) @@ -277,7 +277,7 @@ def getchanges(self, rev, full): if full: - raise util.Abort(_("convert from p4 do not support --full")) + raise error.Abort(_("convert from p4 do not support --full")) return self.files[rev], self.copies[rev], set() def getcommit(self, rev):
--- a/hgext/convert/subversion.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/convert/subversion.py Thu Oct 08 12:55:45 2015 -0700 @@ -6,7 +6,7 @@ import xml.dom.minidom import cPickle as pickle -from mercurial import strutil, scmutil, util, encoding +from mercurial import strutil, scmutil, util, encoding, error from mercurial.i18n import _ propertycache = util.propertycache @@ -141,7 +141,7 @@ avoid memory collection issues. """ if svn is None: - raise util.Abort(_('debugsvnlog could not load Subversion python ' + raise error.Abort(_('debugsvnlog could not load Subversion python ' 'bindings')) util.setbinary(sys.stdin) @@ -159,14 +159,14 @@ try: entry = pickle.load(self._stdout) except EOFError: - raise util.Abort(_('Mercurial failed to run itself, check' + raise error.Abort(_('Mercurial failed to run itself, check' ' hg executable is in PATH')) try: orig_paths, revnum, author, date, message = entry except (TypeError, ValueError): if entry is None: break - raise util.Abort(_("log stream exception '%s'") % entry) + raise error.Abort(_("log stream exception '%s'") % entry) yield entry def close(self): @@ -327,12 +327,12 @@ if revs: if len(revs) > 1: - raise util.Abort(_('subversion source does not support ' + raise error.Abort(_('subversion source does not support ' 'specifying multiple revisions')) try: latest = int(revs[0]) except ValueError: - raise util.Abort(_('svn: revision %s is not an integer') % + raise error.Abort(_('svn: revision %s is not an integer') % revs[0]) self.trunkname = self.ui.config('convert', 'svn.trunk', @@ -343,7 +343,7 @@ if self.startrev < 0: self.startrev = 0 except ValueError: - raise util.Abort(_('svn: start revision %s is not an integer') + raise error.Abort(_('svn: start revision %s is not an integer') % self.startrev) try: @@ -351,7 +351,7 @@ except SvnPathNotFound: self.head = None if not self.head: - raise util.Abort(_('no revision found in module %s') + raise error.Abort(_('no revision found in module %s') % self.module) self.last_changed = self.revnum(self.head) @@ -396,8 +396,8 @@ # we are converting from inside this directory return None if cfgpath: - raise util.Abort(_('expected %s to be at %r, but not found') - % (name, path)) + raise error.Abort(_('expected %s to be at %r, but not found' + ) % (name, path)) return None self.ui.note(_('found %s at %r\n') % (name, path)) return path @@ -415,7 +415,7 @@ self.module += '/' + trunk self.head = self.latest(self.module, self.last_changed) if not self.head: - raise util.Abort(_('no revision found in module %s') + raise error.Abort(_('no revision found in module %s') % self.module) # First head in the list is the module's head @@ -442,11 +442,11 @@ if self.startrev and self.heads: if len(self.heads) > 1: - raise util.Abort(_('svn: start revision is not supported ' + raise error.Abort(_('svn: start revision is not supported ' 'with more than one branch')) revnum = self.revnum(self.heads[0]) if revnum < self.startrev: - raise util.Abort( + raise error.Abort( _('svn: no revision found after start revision %d') % self.startrev) @@ -502,7 +502,7 @@ stop = revnum + 1 self._fetch_revisions(revnum, stop) if rev not in self.commits: - raise util.Abort(_('svn: revision %s not found') % revnum) + raise error.Abort(_('svn: revision %s not found') % revnum) revcommit = self.commits[rev] # caller caches the result, so free it here to release memory del self.commits[rev] @@ -513,7 +513,7 @@ if not re.match(r'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-' '[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]' '{12,12}(.*)\@[0-9]+$',revstr): - raise util.Abort(_('%s entry %s is not a valid revision' + raise error.Abort(_('%s entry %s is not a valid revision' ' identifier') % (mapname, revstr)) def numcommits(self): @@ -951,7 +951,7 @@ except SubversionException as xxx_todo_changeme: (inst, num) = xxx_todo_changeme.args if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: - raise util.Abort(_('svn: branch has no revision %s') + raise error.Abort(_('svn: branch has no revision %s') % to_revnum) raise @@ -1052,7 +1052,7 @@ try: stdin.close() except IOError: - raise util.Abort(_('Mercurial failed to run itself, check' + raise error.Abort(_('Mercurial failed to run itself, check' ' hg executable is in PATH')) return logstream(stdout) @@ -1302,7 +1302,7 @@ return parents[0] self.ui.warn(_('unexpected svn output:\n')) self.ui.warn(output) - raise util.Abort(_('unable to cope with svn output')) + raise error.Abort(_('unable to cope with svn output')) if commit.rev: self.run('propset', 'hg:convert-rev', commit.rev, revprop=True, revision=rev) @@ -1329,6 +1329,6 @@ # repository and childmap would not list all revisions. Too bad. if rev in self.childmap: return True - raise util.Abort(_('splice map revision %s not found in subversion ' + raise error.Abort(_('splice map revision %s not found in subversion ' 'child map (revision lookups are not implemented)') % rev)
--- a/hgext/eol.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/eol.py Thu Oct 08 12:55:45 2015 -0700 @@ -247,7 +247,7 @@ for node, target, f in failed: msgs.append(_(" %s in %s should not have %s line endings") % (f, node, eols[target])) - raise util.Abort(_("end-of-line check failed:\n") + "\n".join(msgs)) + raise error.Abort(_("end-of-line check failed:\n") + "\n".join(msgs)) def checkallhook(ui, repo, node, hooktype, **kwargs): """verify that files have expected EOLs""" @@ -347,7 +347,7 @@ # have all non-binary files taken care of. continue if inconsistenteol(data): - raise util.Abort(_("inconsistent newline style " + raise error.Abort(_("inconsistent newline style " "in %s\n") % f) return super(eolrepo, self).commitctx(ctx, haserror) repo.__class__ = eolrepo
--- a/hgext/extdiff.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/extdiff.py Thu Oct 08 12:55:45 2015 -0700 @@ -63,7 +63,7 @@ from mercurial.i18n import _ from mercurial.node import short, nullid from mercurial import cmdutil, scmutil, util, commands, encoding, filemerge -from mercurial import archival +from mercurial import archival, error import os, shlex, shutil, tempfile, re cmdtable = {} @@ -127,7 +127,7 @@ if revs and change: msg = _('cannot specify --rev and --change at the same time') - raise util.Abort(msg) + raise error.Abort(msg) elif change: node2 = scmutil.revsingle(repo, change, None).node() node1a, node1b = repo.changelog.parents(node2) @@ -149,9 +149,9 @@ if opts.get('patch'): if subrepos: - raise util.Abort(_('--patch cannot be used with --subrepos')) + raise error.Abort(_('--patch cannot be used with --subrepos')) if node2 is None: - raise util.Abort(_('--patch requires two revisions')) + raise error.Abort(_('--patch requires two revisions')) else: mod_a, add_a, rem_a = map(set, repo.status(node1a, node2, matcher, listsubrepos=subrepos)[:3])
--- a/hgext/factotum.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/factotum.py Thu Oct 08 12:55:45 2015 -0700 @@ -47,7 +47,7 @@ from mercurial.i18n import _ from mercurial.url import passwordmgr -from mercurial import httpconnection, util +from mercurial import httpconnection, error import os, urllib2 ERRMAX = 128 @@ -56,7 +56,7 @@ def auth_getkey(self, params): if not self.ui.interactive(): - raise util.Abort(_('factotum not interactive')) + raise error.Abort(_('factotum not interactive')) if 'user=' not in params: params = '%s user?' % params params = '%s !password?' % params @@ -77,10 +77,10 @@ if passwd.endswith("'"): passwd = passwd[1:-1].replace("''", "'") else: - raise util.Abort(_('malformed password string')) + raise error.Abort(_('malformed password string')) return (user, passwd) except (OSError, IOError): - raise util.Abort(_('factotum not responding')) + raise error.Abort(_('factotum not responding')) finally: os.close(fd) getkey(self, params)
--- a/hgext/fetch.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/fetch.py Thu Oct 08 12:55:45 2015 -0700 @@ -60,7 +60,7 @@ except error.RepoLookupError: branchnode = None if parent != branchnode: - raise util.Abort(_('working directory not at branch tip'), + raise error.Abort(_('working directory not at branch tip'), hint=_('use "hg update" to check out branch tip')) wlock = lock = None @@ -73,7 +73,7 @@ bheads = repo.branchheads(branch) bheads = [head for head in bheads if len(repo[head].children()) == 0] if len(bheads) > 1: - raise util.Abort(_('multiple heads in this branch ' + raise error.Abort(_('multiple heads in this branch ' '(use "hg heads ." and "hg merge" to merge)')) other = hg.peer(repo, opts, ui.expandpath(source)) @@ -86,7 +86,7 @@ except error.CapabilityError: err = _("other repository doesn't support revision lookup, " "so a rev cannot be specified.") - raise util.Abort(err) + raise error.Abort(err) # Are there any changes at all? modheads = exchange.pull(repo, other, heads=revs).cgresult
--- a/hgext/gpg.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/gpg.py Thu Oct 08 12:55:45 2015 -0700 @@ -6,7 +6,7 @@ '''commands to sign and verify changesets''' import os, tempfile, binascii -from mercurial import util, commands, match, cmdutil +from mercurial import util, commands, match, cmdutil, error from mercurial import node as hgnode from mercurial.i18n import _ @@ -237,7 +237,7 @@ nodes = [node for node in repo.dirstate.parents() if node != hgnode.nullid] if len(nodes) > 1: - raise util.Abort(_('uncommitted merge - please provide a ' + raise error.Abort(_('uncommitted merge - please provide a ' 'specific revision')) if not nodes: nodes = [repo.changelog.tip()] @@ -250,7 +250,7 @@ data = node2txt(repo, n, sigver) sig = mygpg.sign(data) if not sig: - raise util.Abort(_("error while signing")) + raise error.Abort(_("error while signing")) sig = binascii.b2a_base64(sig) sig = sig.replace("\n", "") sigmessage += "%s %s %s\n" % (hexnode, sigver, sig) @@ -263,7 +263,7 @@ if not opts["force"]: msigs = match.exact(repo.root, '', ['.hgsigs']) if any(repo.status(match=msigs, unknown=True, ignored=True)): - raise util.Abort(_("working copy of .hgsigs is changed "), + raise error.Abort(_("working copy of .hgsigs is changed "), hint=_("please commit .hgsigs manually")) sigsfile = repo.wfile(".hgsigs", "ab") @@ -287,7 +287,7 @@ repo.commit(message, opts['user'], opts['date'], match=msigs, editor=editor) except ValueError as inst: - raise util.Abort(str(inst)) + raise error.Abort(str(inst)) def shortkey(ui, key): if len(key) != 16: @@ -301,4 +301,4 @@ if ver == "0": return "%s\n" % hgnode.hex(node) else: - raise util.Abort(_("unknown signature version")) + raise error.Abort(_("unknown signature version"))
--- a/hgext/hgcia.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/hgcia.py Thu Oct 08 12:55:45 2015 -0700 @@ -43,7 +43,7 @@ from mercurial.i18n import _ from mercurial.node import bin, short -from mercurial import cmdutil, patch, util, mail +from mercurial import cmdutil, patch, util, mail, error import email.Parser import socket, xmlrpclib @@ -233,7 +233,7 @@ srv = xmlrpclib.Server(self.ciaurl) res = srv.hub.deliver(msg) if res is not True and res != 'queued.': - raise util.Abort(_('%s returned an error: %s') % + raise error.Abort(_('%s returned an error: %s') % (self.ciaurl, res)) def sendemail(self, address, data): @@ -259,7 +259,7 @@ ui.write(msg) elif cia.ciaurl.startswith('mailto:'): if not cia.emailfrom: - raise util.Abort(_('email.from must be defined when ' + raise error.Abort(_('email.from must be defined when ' 'sending by email')) cia.sendemail(cia.ciaurl[7:], msg) else:
--- a/hgext/histedit.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/histedit.py Thu Oct 08 12:55:45 2015 -0700 @@ -225,7 +225,7 @@ except IOError as err: if err.errno != errno.ENOENT: raise - raise util.Abort(_('no histedit in progress')) + raise error.Abort(_('no histedit in progress')) try: data = pickle.load(fp) @@ -331,7 +331,7 @@ try: node = repo[rulehash].node() except error.RepoError: - raise util.Abort(_('unknown changeset %s listed') % rulehash[:12]) + raise error.Abort(_('unknown changeset %s listed') % rulehash[:12]) return cls(state, node) def run(self): @@ -439,7 +439,7 @@ return None for c in ctxs: if not c.mutable(): - raise util.Abort( + raise error.Abort( _("cannot fold into public change %s") % node.short(c.node())) base = first.parents()[0] @@ -664,12 +664,12 @@ outgoing = discovery.findcommonoutgoing(repo, other, revs, force=force) if not outgoing.missing: - raise util.Abort(_('no outgoing ancestors')) + raise error.Abort(_('no outgoing ancestors')) roots = list(repo.revs("roots(%ln)", outgoing.missing)) if 1 < len(roots): msg = _('there are ambiguous outgoing revisions') hint = _('see "hg help histedit" for more detail') - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) return repo.lookup(roots[0]) actiontable = {'p': pick, @@ -736,7 +736,7 @@ # blanket if mq patches are applied somewhere mq = getattr(repo, 'mq', None) if mq and mq.applied: - raise util.Abort(_('source has mq patches applied')) + raise error.Abort(_('source has mq patches applied')) # basic argument incompatibility processing outg = opts.get('outgoing') @@ -748,29 +748,29 @@ revs = opts.get('rev', []) goal = 'new' # This invocation goal, in new, continue, abort if force and not outg: - raise util.Abort(_('--force only allowed with --outgoing')) + raise error.Abort(_('--force only allowed with --outgoing')) if cont: if any((outg, abort, revs, freeargs, rules, editplan)): - raise util.Abort(_('no arguments allowed with --continue')) + raise error.Abort(_('no arguments allowed with --continue')) goal = 'continue' elif abort: if any((outg, revs, freeargs, rules, editplan)): - raise util.Abort(_('no arguments allowed with --abort')) + raise error.Abort(_('no arguments allowed with --abort')) goal = 'abort' elif editplan: if any((outg, revs, freeargs)): - raise util.Abort(_('only --commands argument allowed with ' + raise error.Abort(_('only --commands argument allowed with ' '--edit-plan')) goal = 'edit-plan' else: if os.path.exists(os.path.join(repo.path, 'histedit-state')): - raise util.Abort(_('history edit already in progress, try ' + raise error.Abort(_('history edit already in progress, try ' '--continue or --abort')) if outg: if revs: - raise util.Abort(_('no revisions allowed with --outgoing')) + raise error.Abort(_('no revisions allowed with --outgoing')) if len(freeargs) > 1: - raise util.Abort( + raise error.Abort( _('only one repo argument allowed with --outgoing')) else: revs.extend(freeargs) @@ -780,7 +780,7 @@ if histeditdefault: revs.append(histeditdefault) if len(revs) != 1: - raise util.Abort( + raise error.Abort( _('histedit requires exactly one ancestor revision')) @@ -856,13 +856,13 @@ else: rr = list(repo.set('roots(%ld)', scmutil.revrange(repo, revs))) if len(rr) != 1: - raise util.Abort(_('The specified revisions must have ' + raise error.Abort(_('The specified revisions must have ' 'exactly one common root')) root = rr[0].node() revs = between(repo, root, topmost, state.keep) if not revs: - raise util.Abort(_('%s is not an ancestor of working directory') % + raise error.Abort(_('%s is not an ancestor of working directory') % node.short(root)) ctxs = [repo[r] for r in revs] @@ -960,7 +960,7 @@ actobj.continuedirty() s = repo.status() if s.modified or s.added or s.removed or s.deleted: - raise util.Abort(_("working copy still dirty")) + raise error.Abort(_("working copy still dirty")) parentctx, replacements = actobj.continueclean() @@ -977,12 +977,12 @@ if ctxs and not keep: if (not obsolete.isenabled(repo, obsolete.allowunstableopt) and repo.revs('(%ld::) - (%ld)', ctxs, ctxs)): - raise util.Abort(_('cannot edit history that would orphan nodes')) + raise error.Abort(_('cannot edit history that would orphan nodes')) if repo.revs('(%ld) and merge()', ctxs): - raise util.Abort(_('cannot edit history that contains merges')) + raise error.Abort(_('cannot edit history that contains merges')) root = ctxs[0] # list is already sorted by repo.set if not root.mutable(): - raise util.Abort(_('cannot edit public changeset: %s') % root, + raise error.Abort(_('cannot edit public changeset: %s') % root, hint=_('see "hg help phases" for details')) return [c.node() for c in ctxs] @@ -1033,26 +1033,26 @@ seen = set() for r in rules: if ' ' not in r: - raise util.Abort(_('malformed line "%s"') % r) + raise error.Abort(_('malformed line "%s"') % r) action, rest = r.split(' ', 1) ha = rest.strip().split(' ', 1)[0] try: ha = repo[ha].hex() except error.RepoError: - raise util.Abort(_('unknown changeset %s listed') % ha[:12]) + raise error.Abort(_('unknown changeset %s listed') % ha[:12]) if ha not in expected: - raise util.Abort( + raise error.Abort( _('may not use changesets other than the ones listed')) if ha in seen: - raise util.Abort(_('duplicated command for changeset %s') % + raise error.Abort(_('duplicated command for changeset %s') % ha[:12]) seen.add(ha) if action not in actiontable or action.startswith('_'): - raise util.Abort(_('unknown action "%s"') % action) + raise error.Abort(_('unknown action "%s"') % action) parsed.append([action, ha]) missing = sorted(expected - seen) # sort to stabilize output if missing: - raise util.Abort(_('missing rules for changeset %s') % + raise error.Abort(_('missing rules for changeset %s') % missing[0][:12], hint=_('do you want to use the drop action?')) return parsed @@ -1208,7 +1208,7 @@ strip_nodes = set([repo[n].node() for n in nodelist]) common_nodes = histedit_nodes & strip_nodes if common_nodes: - raise util.Abort(_("histedit in progress, can't strip %s") + raise error.Abort(_("histedit in progress, can't strip %s") % ', '.join(node.short(x) for x in common_nodes)) return orig(ui, repo, nodelist, *args, **kwargs)
--- a/hgext/keyword.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/keyword.py Thu Oct 08 12:55:45 2015 -0700 @@ -83,7 +83,7 @@ ''' from mercurial import commands, context, cmdutil, dispatch, filelog, extensions -from mercurial import localrepo, match, patch, templatefilters, util +from mercurial import localrepo, match, patch, templatefilters, util, error from mercurial import scmutil, pathutil from mercurial.hgweb import webcommands from mercurial.i18n import _ @@ -348,20 +348,20 @@ return repo.status(match=scmutil.match(wctx, pats, opts), clean=True, unknown=opts.get('unknown') or opts.get('all')) if ui.configitems('keyword'): - raise util.Abort(_('[keyword] patterns cannot match')) - raise util.Abort(_('no [keyword] patterns configured')) + raise error.Abort(_('[keyword] patterns cannot match')) + raise error.Abort(_('no [keyword] patterns configured')) def _kwfwrite(ui, repo, expand, *pats, **opts): '''Selects files and passes them to kwtemplater.overwrite.''' wctx = repo[None] if len(wctx.parents()) > 1: - raise util.Abort(_('outstanding uncommitted merge')) + raise error.Abort(_('outstanding uncommitted merge')) kwt = kwtools['templater'] wlock = repo.wlock() try: status = _status(ui, repo, wctx, kwt, *pats, **opts) if status.modified or status.added or status.removed or status.deleted: - raise util.Abort(_('outstanding uncommitted changes')) + raise error.Abort(_('outstanding uncommitted changes')) kwt.overwrite(wctx, status.clean, True, expand) finally: wlock.release()
--- a/hgext/largefiles/basestore.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/basestore.py Thu Oct 08 12:55:45 2015 -0700 @@ -10,7 +10,7 @@ import re -from mercurial import util, node, hg +from mercurial import util, node, hg, error from mercurial.i18n import _ import lfutil @@ -209,7 +209,7 @@ try: storeproviders = _storeprovider[scheme] except KeyError: - raise util.Abort(_('unsupported URL scheme %r') % scheme) + raise error.Abort(_('unsupported URL scheme %r') % scheme) for classobj in storeproviders: try: @@ -217,5 +217,5 @@ except lfutil.storeprotonotcapable: pass - raise util.Abort(_('%s does not appear to be a largefile store') % + raise error.Abort(_('%s does not appear to be a largefile store') % util.hidepassword(path))
--- a/hgext/largefiles/lfcommands.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/lfcommands.py Thu Oct 08 12:55:45 2015 -0700 @@ -62,9 +62,9 @@ size = lfutil.getminsize(ui, True, opts.get('size'), default=None) if not hg.islocal(src): - raise util.Abort(_('%s is not a local Mercurial repo') % src) + raise error.Abort(_('%s is not a local Mercurial repo') % src) if not hg.islocal(dest): - raise util.Abort(_('%s is not a local Mercurial repo') % dest) + raise error.Abort(_('%s is not a local Mercurial repo') % dest) rsrc = hg.repository(ui, src) ui.status(_('initializing destination %s\n') % dest) @@ -139,7 +139,7 @@ path = lfutil.findfile(rsrc, hash) if path is None: - raise util.Abort(_("missing largefile for \'%s\' in %s") + raise error.Abort(_("missing largefile for '%s' in %s") % (realname, realrev)) fp = open(path, 'rb') @@ -157,7 +157,7 @@ found, missing = downloadlfiles(ui, rsrc) if missing != 0: - raise util.Abort(_("all largefiles must be present locally")) + raise error.Abort(_("all largefiles must be present locally")) orig = convcmd.converter convcmd.converter = converter @@ -196,7 +196,7 @@ islfile |= renamedlfile if 'l' in fctx.flags(): if renamedlfile: - raise util.Abort( + raise error.Abort( _('renamed/copied largefile %s becomes symlink') % f) islfile = False @@ -213,7 +213,7 @@ if 'l' in fctx.flags(): renamed = fctx.renamed() if renamed and renamed[0] in lfiles: - raise util.Abort(_('largefile %s becomes symlink') % f) + raise error.Abort(_('largefile %s becomes symlink') % f) # largefile was modified, update standins m = util.sha1('') @@ -355,7 +355,7 @@ total=len(files)) source = lfutil.findfile(rsrc, hash) if not source: - raise util.Abort(_('largefile %s missing from store' + raise error.Abort(_('largefile %s missing from store' ' (needs to be uploaded)') % hash) # XXX check for errors here store.put(source, hash) @@ -539,7 +539,7 @@ revs = opts.get('rev', []) if not revs: - raise util.Abort(_('no revisions specified')) + raise error.Abort(_('no revisions specified')) revs = scmutil.revrange(repo, revs) numcached = 0
--- a/hgext/largefiles/lfutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/lfutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -16,7 +16,7 @@ from mercurial import dirstate, httpconnection, match as match_, util, scmutil from mercurial.i18n import _ -from mercurial import node +from mercurial import node, error shortname = '.hglf' shortnameslash = shortname + '/' @@ -33,10 +33,10 @@ try: lfsize = float(lfsize) except ValueError: - raise util.Abort(_('largefiles: size must be number (not %s)\n') + raise error.Abort(_('largefiles: size must be number (not %s)\n') % lfsize) if lfsize is None: - raise util.Abort(_('minimum size for largefiles must be specified')) + raise error.Abort(_('minimum size for largefiles must be specified')) return lfsize def link(src, dest): @@ -74,7 +74,7 @@ if home: path = os.path.join(home, '.cache', longname, hash) else: - raise util.Abort(_('unknown operating system: %s\n') % os.name) + raise error.Abort(_('unknown operating system: %s\n') % os.name) return path def inusercache(ui, hash):
--- a/hgext/largefiles/overrides.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/overrides.py Thu Oct 08 12:55:45 2015 -0700 @@ -12,7 +12,7 @@ import copy from mercurial import hg, util, cmdutil, scmutil, match as match_, \ - archival, pathutil, revset + archival, pathutil, revset, error from mercurial.i18n import _ import lfutil @@ -245,7 +245,7 @@ def overrideadd(orig, ui, repo, *pats, **opts): if opts.get('normal') and opts.get('large'): - raise util.Abort(_('--normal cannot be used with --large')) + raise error.Abort(_('--normal cannot be used with --large')) return orig(ui, repo, *pats, **opts) def cmdutiladd(orig, ui, repo, matcher, prefix, explicitonly, **opts): @@ -584,7 +584,7 @@ installnormalfilesmatchfn(repo[None].manifest()) try: result = orig(ui, repo, pats, opts, rename) - except util.Abort as e: + except error.Abort as e: if str(e) != _('no files to copy'): raise e else: @@ -688,7 +688,7 @@ lfdirstate.add(destlfile) lfdirstate.write() - except util.Abort as e: + except error.Abort as e: if str(e) != _('no files to copy'): raise e else: @@ -698,7 +698,7 @@ wlock.release() if nolfiles and nonormalfiles: - raise util.Abort(_('no files to copy')) + raise error.Abort(_('no files to copy')) return result @@ -827,7 +827,7 @@ try: firstpulled = repo.firstpulled except AttributeError: - raise util.Abort(_("pulled() only available in --lfrev")) + raise error.Abort(_("pulled() only available in --lfrev")) return revset.baseset([r for r in subset if r >= firstpulled]) def overrideclone(orig, ui, source, dest=None, **opts): @@ -835,7 +835,7 @@ if d is None: d = hg.defaultdest(source) if opts.get('all_largefiles') and not hg.islocal(d): - raise util.Abort(_( + raise error.Abort(_( '--all-largefiles is incompatible with non-local destination %s') % d) @@ -916,13 +916,13 @@ lfcommands.cachelfiles(repo.ui, repo, node) if kind not in archival.archivers: - raise util.Abort(_("unknown archive type '%s'") % kind) + raise error.Abort(_("unknown archive type '%s'") % kind) ctx = repo[node] if kind == 'files': if prefix: - raise util.Abort( + raise error.Abort( _('cannot give prefix when archiving to files')) else: prefix = archival.tidyprefix(dest, kind, prefix) @@ -949,7 +949,7 @@ path = lfutil.findfile(repo, getdata().strip()) if path is None: - raise util.Abort( + raise error.Abort( _('largefile %s not found in repo store or system cache') % lfutil.splitstandin(f)) else: @@ -1006,7 +1006,7 @@ path = lfutil.findfile(repo._repo, getdata().strip()) if path is None: - raise util.Abort( + raise error.Abort( _('largefile %s not found in repo store or system cache') % lfutil.splitstandin(f)) else: @@ -1043,7 +1043,7 @@ s = repo.status() repo.lfstatus = False if s.modified or s.added or s.removed or s.deleted: - raise util.Abort(_('uncommitted changes')) + raise error.Abort(_('uncommitted changes')) def cmdutilforget(orig, ui, repo, match, prefix, explicitonly): normalmatcher = composenormalfilematcher(match, repo[None].manifest()) @@ -1344,7 +1344,7 @@ store = basestore._openstore(repo) success, missing = store.get([(lf, hash)]) if len(success) != 1: - raise util.Abort( + raise error.Abort( _('largefile %s is not in cache and could not be ' 'downloaded') % lf) path = lfutil.usercachepath(repo.ui, hash)
--- a/hgext/largefiles/proto.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/proto.py Thu Oct 08 12:55:45 2015 -0700 @@ -51,7 +51,8 @@ cache.''' filename = lfutil.findfile(repo, sha) if not filename: - raise util.Abort(_('requested largefile %s not present in cache') % sha) + raise error.Abort(_('requested largefile %s not present in cache') + % sha) f = open(filename, 'rb') length = os.fstat(f.fileno())[6]
--- a/hgext/largefiles/remotestore.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/remotestore.py Thu Oct 08 12:55:45 2015 -0700 @@ -8,7 +8,7 @@ import urllib2 -from mercurial import util, wireproto +from mercurial import util, wireproto, error from mercurial.i18n import _ import lfutil @@ -21,7 +21,7 @@ def put(self, source, hash): if self.sendfile(source, hash): - raise util.Abort( + raise error.Abort( _('remotestore: could not put %s to remote store %s') % (source, util.hidepassword(self.url))) self.ui.debug( @@ -39,7 +39,7 @@ fd = lfutil.httpsendfile(self.ui, filename) return self._put(hash, fd) except IOError as e: - raise util.Abort( + raise error.Abort( _('remotestore: could not open file %s: %s') % (filename, str(e))) finally: @@ -50,14 +50,14 @@ try: chunks = self._get(hash) except urllib2.HTTPError as e: - # 401s get converted to util.Aborts; everything else is fine being + # 401s get converted to error.Aborts; everything else is fine being # turned into a StoreError raise basestore.StoreError(filename, hash, self.url, str(e)) except urllib2.URLError as e: # This usually indicates a connection problem, so don't # keep trying with the other files... they will probably # all fail too. - raise util.Abort('%s: %s' % + raise error.Abort('%s: %s' % (util.hidepassword(self.url), e.reason)) except IOError as e: raise basestore.StoreError(filename, hash, self.url, str(e))
--- a/hgext/largefiles/reposetup.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/largefiles/reposetup.py Thu Oct 08 12:55:45 2015 -0700 @@ -10,7 +10,7 @@ import copy import os -from mercurial import error, match as match_, util +from mercurial import error, match as match_, error from mercurial.i18n import _ from mercurial import scmutil, localrepo @@ -280,7 +280,7 @@ msg = _("required features are not" " supported in the destination:" " %s") % (', '.join(sorted(missing))) - raise util.Abort(msg) + raise error.Abort(msg) return super(lfilesrepo, self).push(remote, force=force, revs=revs, newbranch=newbranch) @@ -304,7 +304,7 @@ for f in files: if lfutil.isstandin(f + '/'): - raise util.Abort( + raise error.Abort( _('file "%s" is a largefile standin') % f, hint=('commit the largefile itself instead')) # Scan directories
--- a/hgext/mq.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/mq.py Thu Oct 08 12:55:45 2015 -0700 @@ -492,7 +492,7 @@ elif self.gitmode in ('yes', 'no'): diffopts.git = self.gitmode == 'yes' else: - raise util.Abort(_('mq.git option can be auto/keep/yes/no' + raise error.Abort(_('mq.git option can be auto/keep/yes/no' ' got %s') % self.gitmode) if patchfn: diffopts = self.patchopts(diffopts, patchfn) @@ -544,7 +544,7 @@ patch = patch.strip() if patch: if patch in self.series: - raise util.Abort(_('%s appears more than once in %s') % + raise error.Abort(_('%s appears more than once in %s') % (patch, self.join(self.seriespath))) self.series.append(patch) self.seriesguards.append(self.guard_re.findall(comment)) @@ -565,7 +565,7 @@ for guard in guards: bad = self.checkguard(guard) if bad: - raise util.Abort(bad) + raise error.Abort(bad) guards = sorted(set(guards)) self.ui.debug('active guards: %s\n' % ' '.join(guards)) self.activeguards = guards @@ -592,12 +592,12 @@ def setguards(self, idx, guards): for g in guards: if len(g) < 2: - raise util.Abort(_('guard %r too short') % g) + raise error.Abort(_('guard %r too short') % g) if g[0] not in '-+': - raise util.Abort(_('guard %r starts with invalid char') % g) + raise error.Abort(_('guard %r starts with invalid char') % g) bad = self.checkguard(g[1:]) if bad: - raise util.Abort(bad) + raise error.Abort(bad) drop = self.guard_re.sub('', self.fullseries[idx]) self.fullseries[idx] = drop + ''.join([' #' + g for g in guards]) self.parseseries() @@ -708,7 +708,7 @@ return (err, n) if n is None: - raise util.Abort(_("apply failed for patch %s") % patch) + raise error.Abort(_("apply failed for patch %s") % patch) self.ui.warn(_("patch didn't work out, merging %s\n") % patch) @@ -719,14 +719,14 @@ ctx = repo[rev] ret = hg.merge(repo, rev) if ret: - raise util.Abort(_("update returned %d") % ret) + raise error.Abort(_("update returned %d") % ret) n = newcommit(repo, None, ctx.description(), ctx.user(), force=True) if n is None: - raise util.Abort(_("repo commit failed")) + raise error.Abort(_("repo commit failed")) try: ph = patchheader(mergeq.join(patch), self.plainmode) except Exception: - raise util.Abort(_("unable to read %s") % patch) + raise error.Abort(_("unable to read %s") % patch) diffopts = self.patchopts(diffopts, patch) patchf = self.opener(patch, "w") @@ -931,9 +931,9 @@ n = newcommit(repo, None, message, ph.user, ph.date, match=match, force=True) if repo['tip'] == oldtip: - raise util.Abort(_("qpush exactly duplicates child changeset")) + raise error.Abort(_("qpush exactly duplicates child changeset")) if n is None: - raise util.Abort(_("repository commit failed")) + raise error.Abort(_("repository commit failed")) if update_status: self.applied.append(statusentry(n, patchname)) @@ -985,7 +985,7 @@ self.ui.warn(msg % (short(rev[p]), p)) else: msg = _('unknown patches: %s\n') - raise util.Abort(''.join(msg % p for p in unknown)) + raise error.Abort(''.join(msg % p for p in unknown)) self.parseseries() self.seriesdirty = True @@ -997,13 +997,13 @@ for i, rev in enumerate(revs): if rev < firstrev: - raise util.Abort(_('revision %d is not managed') % rev) + raise error.Abort(_('revision %d is not managed') % rev) ctx = repo[rev] base = self.applied[i].node if ctx.node() != base: msg = _('cannot delete revision %d above applied patches') - raise util.Abort(msg % rev) + raise error.Abort(msg % rev) patch = self.applied[i].name for fmt in ('[mq]: %s', 'imported patch %s'): @@ -1035,7 +1035,7 @@ def delete(self, repo, patches, opts): if not patches and not opts.get('rev'): - raise util.Abort(_('qdelete requires at least one revision or ' + raise error.Abort(_('qdelete requires at least one revision or ' 'patch name')) realpatches = [] @@ -1043,16 +1043,16 @@ patch = self.lookup(patch, strict=True) info = self.isapplied(patch) if info: - raise util.Abort(_("cannot delete applied patch %s") % patch) + raise error.Abort(_("cannot delete applied patch %s") % patch) if patch not in self.series: - raise util.Abort(_("patch %s not in series file") % patch) + raise error.Abort(_("patch %s not in series file") % patch) if patch not in realpatches: realpatches.append(patch) numrevs = 0 if opts.get('rev'): if not self.applied: - raise util.Abort(_('no patches applied')) + raise error.Abort(_('no patches applied')) revs = scmutil.revrange(repo, opts.get('rev')) revs.sort() revpatches = self._revpatches(repo, revs) @@ -1067,7 +1067,7 @@ top = self.applied[-1].node patch = self.applied[-1].name if repo.dirstate.p1() != top: - raise util.Abort(_("working directory revision is not qtip")) + raise error.Abort(_("working directory revision is not qtip")) return top, patch return None, None @@ -1095,29 +1095,29 @@ _reserved = ('series', 'status', 'guards', '.', '..') def checkreservedname(self, name): if name in self._reserved: - raise util.Abort(_('"%s" cannot be used as the name of a patch') + raise error.Abort(_('"%s" cannot be used as the name of a patch') % name) for prefix in ('.hg', '.mq'): if name.startswith(prefix): - raise util.Abort(_('patch name cannot begin with "%s"') + raise error.Abort(_('patch name cannot begin with "%s"') % prefix) for c in ('#', ':', '\r', '\n'): if c in name: - raise util.Abort(_('%r cannot be used in the name of a patch') + raise error.Abort(_('%r cannot be used in the name of a patch') % c) def checkpatchname(self, name, force=False): self.checkreservedname(name) if not force and os.path.exists(self.join(name)): if os.path.isdir(self.join(name)): - raise util.Abort(_('"%s" already exists as a directory') + raise error.Abort(_('"%s" already exists as a directory') % name) else: - raise util.Abort(_('patch "%s" already exists') % name) + raise error.Abort(_('patch "%s" already exists') % name) def checkkeepchanges(self, keepchanges, force): if force and keepchanges: - raise util.Abort(_('cannot use both --force and --keep-changes')) + raise error.Abort(_('cannot use both --force and --keep-changes')) def new(self, repo, patchfn, *pats, **opts): """options: @@ -1140,7 +1140,7 @@ # detect missing files in pats def badfn(f, msg): if f != '.hgsubstate': # .hgsubstate is auto-created - raise util.Abort('%s: %s' % (f, msg)) + raise error.Abort('%s: %s' % (f, msg)) match = scmutil.match(repo[None], pats, opts, badfn=badfn) changes = repo.status(match=match) else: @@ -1150,7 +1150,7 @@ commitfiles.extend(files) match = scmutil.matchfiles(repo, commitfiles) if len(repo[None].parents()) > 1: - raise util.Abort(_('cannot manage merge changesets')) + raise error.Abort(_('cannot manage merge changesets')) self.checktoppatch(repo) insert = self.fullseriesend() wlock = repo.wlock() @@ -1159,7 +1159,7 @@ # if patch file write fails, abort early p = self.opener(patchfn, "w") except IOError as e: - raise util.Abort(_('cannot write patch "%s": %s') + raise error.Abort(_('cannot write patch "%s": %s') % (patchfn, e.strerror)) try: defaultmsg = "[mq]: %s" % patchfn @@ -1182,7 +1182,7 @@ n = newcommit(repo, None, commitmsg, user, date, match=match, force=True, editor=editor) if n is None: - raise util.Abort(_("repo commit failed")) + raise error.Abort(_("repo commit failed")) try: self.fullseries[insert:insert] = [patchfn] self.applied.append(statusentry(n, patchfn)) @@ -1299,7 +1299,7 @@ else: if i + off < len(self.series): return self.series[i + off] - raise util.Abort(_("patch %s not in series") % patch) + raise error.Abort(_("patch %s not in series") % patch) def push(self, repo, patch=None, force=False, list=False, mergeq=None, all=False, move=False, exact=False, nobackup=False, @@ -1335,7 +1335,7 @@ pushable, reason = self.pushable(patch) if pushable: if self.series.index(patch) < self.seriesend(): - raise util.Abort( + raise error.Abort( _("cannot push to a previous patch: %s") % patch) else: if reason: @@ -1364,25 +1364,25 @@ if exact: if keepchanges: - raise util.Abort( + raise error.Abort( _("cannot use --exact and --keep-changes together")) if move: - raise util.Abort(_('cannot use --exact and --move ' + raise error.Abort(_('cannot use --exact and --move ' 'together')) if self.applied: - raise util.Abort(_('cannot push --exact with applied ' + raise error.Abort(_('cannot push --exact with applied ' 'patches')) root = self.series[start] target = patchheader(self.join(root), self.plainmode).parent if not target: - raise util.Abort( + raise error.Abort( _("%s does not have a parent recorded") % root) if not repo[target] == repo['.']: hg.update(repo, target) if move: if not patch: - raise util.Abort(_("please specify the patch to move")) + raise error.Abort(_("please specify the patch to move")) for fullstart, rpn in enumerate(self.fullseries): # strip markers for patch guards if self.guard_re.split(rpn, 1)[0] == self.series[start]: @@ -1464,7 +1464,7 @@ patch = self.lookup(patch) info = self.isapplied(patch) if not info: - raise util.Abort(_("patch %s is not applied") % patch) + raise error.Abort(_("patch %s is not applied") % patch) if not self.applied: # Allow qpop -a to work repeatedly, @@ -1517,13 +1517,13 @@ heads = repo.changelog.heads(rev) except error.LookupError: node = short(rev) - raise util.Abort(_('trying to pop unknown node %s') % node) + raise error.Abort(_('trying to pop unknown node %s') % node) if heads != [self.applied[-1].node]: - raise util.Abort(_("popping would remove a revision not " + raise error.Abort(_("popping would remove a revision not " "managed by this patch queue")) if not repo[self.applied[-1].node].mutable(): - raise util.Abort( + raise error.Abort( _("popping would remove a public revision"), hint=_('see "hg help phases" for details')) @@ -1534,11 +1534,11 @@ ctx = repo[qp] m, a, r, d = repo.status(qp, '.')[:4] if d: - raise util.Abort(_("deletions found between repo revs")) + raise error.Abort(_("deletions found between repo revs")) tobackup = set(a + m + r) & tobackup if keepchanges and tobackup: - raise util.Abort(_("local changes found, refresh first")) + raise error.Abort(_("local changes found, refresh first")) self.backup(repo, tobackup) repo.dirstate.beginparentchange() for f in a: @@ -1593,9 +1593,9 @@ self.checktoppatch(repo) (top, patchfn) = (self.applied[-1].node, self.applied[-1].name) if repo.changelog.heads(top) != [top]: - raise util.Abort(_("cannot refresh a revision with children")) + raise error.Abort(_("cannot refresh a revision with children")) if not repo[top].mutable(): - raise util.Abort(_("cannot refresh public revision"), + raise error.Abort(_("cannot refresh public revision"), hint=_('see "hg help phases" for details')) cparents = repo.changelog.parents(top) @@ -1812,7 +1812,7 @@ def init(self, repo, create=False): if not create and os.path.isdir(self.path): - raise util.Abort(_("patch queue directory already exists")) + raise error.Abort(_("patch queue directory already exists")) try: os.mkdir(self.path) except OSError as inst: @@ -1823,7 +1823,7 @@ def unapplied(self, repo, patch=None): if patch and patch not in self.series: - raise util.Abort(_("patch %s is not in series file") % patch) + raise error.Abort(_("patch %s is not in series file") % patch) if not patch: start = self.seriesend() else: @@ -2031,19 +2031,19 @@ force=None, git=False): def checkseries(patchname): if patchname in self.series: - raise util.Abort(_('patch %s is already in the series file') + raise error.Abort(_('patch %s is already in the series file') % patchname) if rev: if files: - raise util.Abort(_('option "-r" not valid when importing ' + raise error.Abort(_('option "-r" not valid when importing ' 'files')) rev = scmutil.revrange(repo, rev) rev.sort(reverse=True) elif not files: - raise util.Abort(_('no files or revisions specified')) + raise error.Abort(_('no files or revisions specified')) if (len(files) > 1 or len(rev) > 1) and patchname: - raise util.Abort(_('option "-n" not valid when importing multiple ' + raise error.Abort(_('option "-n" not valid when importing multiple ' 'patches')) imported = [] if rev: @@ -2052,21 +2052,21 @@ # Otherwise, they should form a linear path to a head. heads = repo.changelog.heads(repo.changelog.node(rev.first())) if len(heads) > 1: - raise util.Abort(_('revision %d is the root of more than one ' + raise error.Abort(_('revision %d is the root of more than one ' 'branch') % rev.last()) if self.applied: base = repo.changelog.node(rev.first()) if base in [n.node for n in self.applied]: - raise util.Abort(_('revision %d is already managed') + raise error.Abort(_('revision %d is already managed') % rev.first()) if heads != [self.applied[-1].node]: - raise util.Abort(_('revision %d is not the parent of ' + raise error.Abort(_('revision %d is not the parent of ' 'the queue') % rev.first()) base = repo.changelog.rev(self.applied[0].node) lastparent = repo.changelog.parentrevs(base)[0] else: if heads != [repo.changelog.node(rev.first())]: - raise util.Abort(_('revision %d has unmanaged children') + raise error.Abort(_('revision %d has unmanaged children') % rev.first()) lastparent = None @@ -2075,16 +2075,16 @@ try: for r in rev: if not repo[r].mutable(): - raise util.Abort(_('revision %d is not mutable') % r, + raise error.Abort(_('revision %d is not mutable') % r, hint=_('see "hg help phases" ' 'for details')) p1, p2 = repo.changelog.parentrevs(r) n = repo.changelog.node(r) if p2 != nullrev: - raise util.Abort(_('cannot import merge revision %d') + raise error.Abort(_('cannot import merge revision %d') % r) if lastparent and lastparent != r: - raise util.Abort(_('revision %d is not the parent of ' + raise error.Abort(_('revision %d is not the parent of ' '%d') % (r, lastparent)) lastparent = p1 @@ -2118,13 +2118,14 @@ for i, filename in enumerate(files): if existing: if filename == '-': - raise util.Abort(_('-e is incompatible with import from -')) + raise error.Abort(_('-e is incompatible with import from -') + ) filename = normname(filename) self.checkreservedname(filename) if util.url(filename).islocal(): originpath = self.join(filename) if not os.path.isfile(originpath): - raise util.Abort( + raise error.Abort( _("patch %s does not exist") % filename) if patchname: @@ -2138,7 +2139,7 @@ else: if filename == '-' and not patchname: - raise util.Abort(_('need --name to import a patch from -')) + raise error.Abort(_('need --name to import a patch from -')) elif not patchname: patchname = normname(os.path.basename(filename.rstrip('/'))) self.checkpatchname(patchname, force) @@ -2150,7 +2151,7 @@ text = fp.read() fp.close() except (OSError, IOError): - raise util.Abort(_("unable to read file %s") % filename) + raise error.Abort(_("unable to read file %s") % filename) patchf = self.opener(patchname, "w") patchf.write(text) patchf.close() @@ -2209,7 +2210,7 @@ if patch: if patch not in q.series: - raise util.Abort(_("patch %s is not in series file") % patch) + raise error.Abort(_("patch %s is not in series file") % patch) end = q.series.index(patch) + 1 else: end = q.seriesend(True) @@ -2241,7 +2242,7 @@ q = repo.mq if patch: if patch not in q.series: - raise util.Abort(_("patch %s is not in series file") % patch) + raise error.Abort(_("patch %s is not in series file") % patch) start = q.series.index(patch) + 1 else: start = q.seriesend(True) @@ -2408,7 +2409,7 @@ try: hg.peer(ui, opts, patchespath) except error.RepoError: - raise util.Abort(_('versioned patch repository not found' + raise error.Abort(_('versioned patch repository not found' ' (see init --mq)')) qbase, destrev = None, None if sr.local(): @@ -2458,7 +2459,7 @@ q = repo.mq r = q.qrepo() if not r: - raise util.Abort('no queue repository') + raise error.Abort('no queue repository') commands.commit(r.ui, r, *pats, **opts) @command("qseries", @@ -2663,9 +2664,9 @@ Returns 0 on success.""" q = repo.mq if not files: - raise util.Abort(_('qfold requires at least one patch name')) + raise error.Abort(_('qfold requires at least one patch name')) if not q.checktoppatch(repo)[0]: - raise util.Abort(_('no patches applied')) + raise error.Abort(_('no patches applied')) q.checklocalchanges(repo) message = cmdutil.logmessage(ui, opts) @@ -2678,7 +2679,7 @@ if p in patches or p == parent: ui.warn(_('skipping already folded patch %s\n') % p) if q.isapplied(p): - raise util.Abort(_('qfold cannot fold already applied patch %s') + raise error.Abort(_('qfold cannot fold already applied patch %s') % p) patches.append(p) @@ -2690,7 +2691,7 @@ pf = q.join(p) (patchsuccess, files, fuzz) = q.patch(repo, pf) if not patchsuccess: - raise util.Abort(_('error folding patch %s') % p) + raise error.Abort(_('error folding patch %s') % p) if not message: ph = patchheader(q.join(parent), q.plainmode) @@ -2789,23 +2790,23 @@ args = list(args) if opts.get('list'): if args or opts.get('none'): - raise util.Abort(_('cannot mix -l/--list with options or ' + raise error.Abort(_('cannot mix -l/--list with options or ' 'arguments')) for i in xrange(len(q.series)): status(i) return if not args or args[0][0:1] in '-+': if not q.applied: - raise util.Abort(_('no patches applied')) + raise error.Abort(_('no patches applied')) patch = q.applied[-1].name if patch is None and args[0][0:1] not in '-+': patch = args.pop(0) if patch is None: - raise util.Abort(_('no patch to work with')) + raise error.Abort(_('no patch to work with')) if args or opts.get('none'): idx = q.findseries(patch) if idx is None: - raise util.Abort(_('no patch named %s') % patch) + raise error.Abort(_('no patch named %s') % patch) q.setguards(idx, args) q.savedirty() else: @@ -3031,10 +3032,10 @@ newpath = os.path.join(q.basepath, opts.get('name')) if os.path.exists(newpath): if not os.path.isdir(newpath): - raise util.Abort(_('destination %s exists and is not ' + raise error.Abort(_('destination %s exists and is not ' 'a directory') % newpath) if not opts.get('force'): - raise util.Abort(_('destination %s exists, ' + raise error.Abort(_('destination %s exists, ' 'use -f to force') % newpath) else: newpath = savename(path) @@ -3178,7 +3179,7 @@ Returns 0 on success. """ if not opts.get('applied') and not revrange: - raise util.Abort(_('no revisions specified')) + raise error.Abort(_('no revisions specified')) elif opts.get('applied'): revrange = ('qbase::qtip',) + revrange @@ -3267,7 +3268,7 @@ def _setactive(name): if q.applied: - raise util.Abort(_('new queue created, but cannot make active ' + raise error.Abort(_('new queue created, but cannot make active ' 'as patches are applied')) _setactivenocheck(name) @@ -3296,12 +3297,12 @@ def _delete(name): if name not in existing: - raise util.Abort(_('cannot delete queue that does not exist')) + raise error.Abort(_('cannot delete queue that does not exist')) current = _getcurrent() if name == current: - raise util.Abort(_('cannot delete currently active queue')) + raise error.Abort(_('cannot delete currently active queue')) fh = repo.vfs('patches.queues.new', 'w') for queue in existing: @@ -3325,14 +3326,14 @@ return if not _validname(name): - raise util.Abort( + raise error.Abort( _('invalid queue name, may not contain the characters ":\\/."')) existing = _getqueues() if opts.get('create'): if name in existing: - raise util.Abort(_('queue "%s" already exists') % name) + raise error.Abort(_('queue "%s" already exists') % name) if _noqueues(): _addqueue(_defaultqueue) _addqueue(name) @@ -3340,15 +3341,16 @@ elif opts.get('rename'): current = _getcurrent() if name == current: - raise util.Abort(_('can\'t rename "%s" to its current name') % name) + raise error.Abort(_('can\'t rename "%s" to its current name') + % name) if name in existing: - raise util.Abort(_('queue "%s" already exists') % name) + raise error.Abort(_('queue "%s" already exists') % name) olddir = _queuedir(current) newdir = _queuedir(name) if os.path.exists(newdir): - raise util.Abort(_('non-queue directory "%s" already exists') % + raise error.Abort(_('non-queue directory "%s" already exists') % newdir) fh = repo.vfs('patches.queues.new', 'w') @@ -3372,7 +3374,7 @@ shutil.rmtree(qdir) else: if name not in existing: - raise util.Abort(_('use --create to create a new queue')) + raise error.Abort(_('use --create to create a new queue')) _setactive(name) def mqphasedefaults(repo, roots): @@ -3403,7 +3405,7 @@ parents = self.dirstate.parents() patches = [s.node for s in self.mq.applied] if parents[0] in patches or parents[1] in patches: - raise util.Abort(errmsg) + raise error.Abort(errmsg) def commit(self, text="", user=None, date=None, match=None, force=False, editor=False, extra={}): @@ -3430,7 +3432,7 @@ # looking for pushed and shared changeset for node in outapplied: if self[node].phase() < phases.secret: - raise util.Abort(_('source has mq patches applied')) + raise error.Abort(_('source has mq patches applied')) # no non-secret patches pushed super(mqrepo, self).checkpush(pushop) @@ -3492,12 +3494,12 @@ if args: repopath = args[0] if not hg.islocal(repopath): - raise util.Abort(_('only a local queue repository ' + raise error.Abort(_('only a local queue repository ' 'may be initialized')) else: repopath = cmdutil.findrepo(os.getcwd()) if not repopath: - raise util.Abort(_('there is no Mercurial repository here ' + raise error.Abort(_('there is no Mercurial repository here ' '(.hg not found)')) repo = hg.repository(ui, repopath) return qinit(ui, repo, True) @@ -3514,7 +3516,7 @@ q = repo.mq r = q.qrepo() if not r: - raise util.Abort(_('no queue repository')) + raise error.Abort(_('no queue repository')) return orig(r.ui, r, *args, **kwargs) def summaryhook(ui, repo):
--- a/hgext/notify.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/notify.py Thu Oct 08 12:55:45 2015 -0700 @@ -135,7 +135,7 @@ import email, socket, time from mercurial.i18n import _ -from mercurial import patch, cmdutil, util, mail +from mercurial import patch, cmdutil, util, mail, error import fnmatch # Note for extension authors: ONLY specify testedwith = 'internal' for @@ -277,7 +277,7 @@ try: msg = p.parsestr(data) except email.Errors.MessageParseError as inst: - raise util.Abort(inst) + raise error.Abort(inst) # store sender and subject sender, subject = msg['From'], msg['Subject']
--- a/hgext/patchbomb.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/patchbomb.py Thu Oct 08 12:55:45 2015 -0700 @@ -60,7 +60,7 @@ import os, errno, socket, tempfile, cStringIO import email -from mercurial import cmdutil, commands, hg, mail, patch, util +from mercurial import cmdutil, commands, hg, mail, patch, util, error from mercurial import scmutil from mercurial.i18n import _ from mercurial.node import bin @@ -501,15 +501,15 @@ mail.validateconfig(ui) if not (revs or rev or outgoing or bundle or patches): - raise util.Abort(_('specify at least one changeset with -r or -o')) + raise error.Abort(_('specify at least one changeset with -r or -o')) if outgoing and bundle: - raise util.Abort(_("--outgoing mode always on with --bundle;" + raise error.Abort(_("--outgoing mode always on with --bundle;" " do not re-specify --outgoing")) if outgoing or bundle: if len(revs) > 1: - raise util.Abort(_("too many destinations")) + raise error.Abort(_("too many destinations")) if revs: dest = revs[0] else: @@ -518,7 +518,7 @@ if rev: if revs: - raise util.Abort(_('use only one form to specify the revision')) + raise error.Abort(_('use only one form to specify the revision')) revs = rev revs = scmutil.revrange(repo, revs) @@ -578,7 +578,7 @@ to = getaddrs('To', ask=True) if not to: # we can get here in non-interactive mode - raise util.Abort(_('no recipient addresses provided')) + raise error.Abort(_('no recipient addresses provided')) cc = getaddrs('Cc', ask=True, default='') or [] bcc = getaddrs('Bcc') or [] replyto = getaddrs('Reply-To') @@ -598,7 +598,7 @@ ui.write('\n') if ui.promptchoice(_('are you sure you want to send (yn)?' '$$ &Yes $$ &No')): - raise util.Abort(_('patchbomb canceled')) + raise error.Abort(_('patchbomb canceled')) ui.write('\n')
--- a/hgext/purge.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/purge.py Thu Oct 08 12:55:45 2015 -0700 @@ -24,7 +24,7 @@ '''command to delete untracked files from the working directory''' -from mercurial import util, commands, cmdutil, scmutil +from mercurial import util, commands, cmdutil, scmutil, error from mercurial.i18n import _ import os @@ -94,7 +94,7 @@ except OSError: m = _('%s cannot be removed') % name if opts['abort_on_err']: - raise util.Abort(m) + raise error.Abort(m) ui.warn(_('warning: %s\n') % m) else: ui.write('%s%s' % (name, eol))
--- a/hgext/rebase.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/rebase.py Thu Oct 08 12:55:45 2015 -0700 @@ -225,20 +225,20 @@ help = "hg%s help -e histedit" % enablehistedit msg = _("interactive history editing is supported by the " "'histedit' extension (see \"%s\")") % help - raise util.Abort(msg) + raise error.Abort(msg) if collapsemsg and not collapsef: - raise util.Abort( + raise error.Abort( _('message can only be specified with collapse')) if contf or abortf: if contf and abortf: - raise util.Abort(_('cannot use both abort and continue')) + raise error.Abort(_('cannot use both abort and continue')) if collapsef: - raise util.Abort( + raise error.Abort( _('cannot use collapse with continue or abort')) if srcf or basef or destf: - raise util.Abort( + raise error.Abort( _('abort and continue do not allow specifying revisions')) if abortf and opts.get('tool', False): ui.warn(_('tool option will be ignored\n')) @@ -255,19 +255,19 @@ else: msg = _('cannot continue inconsistent rebase') hint = _('use "hg rebase --abort" to clear broken state') - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) if abortf: return abort(repo, originalwd, target, state, activebookmark=activebookmark) else: if srcf and basef: - raise util.Abort(_('cannot specify both a ' + raise error.Abort(_('cannot specify both a ' 'source and a base')) if revf and basef: - raise util.Abort(_('cannot specify both a ' + raise error.Abort(_('cannot specify both a ' 'revision and a base')) if revf and srcf: - raise util.Abort(_('cannot specify both a ' + raise error.Abort(_('cannot specify both a ' 'revision and a source')) cmdutil.checkunfinished(repo) @@ -335,7 +335,7 @@ if (not (keepf or allowunstable) and repo.revs('first(children(%ld) - %ld)', rebaseset, rebaseset)): - raise util.Abort( + raise error.Abort( _("can't remove original changesets with" " unrebased descendants"), hint=_('use --keep to keep original changesets')) @@ -361,7 +361,7 @@ root = min(rebaseset) if not keepf and not repo[root].mutable(): - raise util.Abort(_("can't rebase public changeset %s") + raise error.Abort(_("can't rebase public changeset %s") % repo[root], hint=_('see "hg help phases" for details')) @@ -384,7 +384,7 @@ for rev in state: branches.add(repo[rev].branch()) if len(branches) > 1: - raise util.Abort(_('cannot collapse multiple named ' + raise error.Abort(_('cannot collapse multiple named ' 'branches')) # Rebase @@ -564,7 +564,7 @@ return nullrev if len(parents) == 1: return parents.pop() - raise util.Abort(_('unable to collapse on top of %s, there is more ' + raise error.Abort(_('unable to collapse on top of %s, there is more ' 'than one external parent: %s') % (max(targetancestors), ', '.join(str(p) for p in sorted(parents)))) @@ -677,7 +677,7 @@ p2 = state[p2n] else: # p2n external if p2 != nullrev: # p1n external too => rev is a merged revision - raise util.Abort(_('cannot use revision %d as base, result ' + raise error.Abort(_('cannot use revision %d as base, result ' 'would have 3 parents') % rev) p2 = p2n repo.ui.debug(" future parents are %d and %d\n" % @@ -866,7 +866,7 @@ state[repo[oldrev].rev()] = repo[newrev].rev() if keepbranches is None: - raise util.Abort(_('.hg/rebasestate is incomplete')) + raise error.Abort(_('.hg/rebasestate is incomplete')) skipped = set() # recompute the set of skipped revs @@ -885,7 +885,7 @@ except IOError as err: if err.errno != errno.ENOENT: raise - raise util.Abort(_('no rebase in progress')) + raise error.Abort(_('no rebase in progress')) def needupdate(repo, state): '''check whether we should `update --clean` away from a merge, or if @@ -959,18 +959,18 @@ # a partially completed rebase is blocked by mq. if 'qtip' in repo.tags() and (dest.node() in [s.node for s in repo.mq.applied]): - raise util.Abort(_('cannot rebase onto an applied mq patch')) + raise error.Abort(_('cannot rebase onto an applied mq patch')) roots = list(repo.set('roots(%ld)', rebaseset)) if not roots: - raise util.Abort(_('no matching revisions')) + raise error.Abort(_('no matching revisions')) roots.sort() state = {} detachset = set() for root in roots: commonbase = root.ancestor(dest) if commonbase == root: - raise util.Abort(_('source is ancestor of destination')) + raise error.Abort(_('source is ancestor of destination')) if commonbase == dest: samebranch = root.branch() == dest.branch() if not collapse and samebranch and root in dest.children(): @@ -1114,7 +1114,7 @@ release(lock, wlock) else: if opts.get('tool'): - raise util.Abort(_('--tool can only be used with --rebase')) + raise error.Abort(_('--tool can only be used with --rebase')) orig(ui, repo, *args, **opts) def _setrebasesetvisibility(repo, revs):
--- a/hgext/record.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/record.py Thu Oct 08 12:55:45 2015 -0700 @@ -9,7 +9,7 @@ from mercurial.i18n import _ from mercurial import cmdutil, commands, extensions -from mercurial import util +from mercurial import error cmdtable = {} command = cmdutil.command(cmdtable) @@ -54,7 +54,7 @@ This command is not available when committing a merge.''' if not ui.interactive(): - raise util.Abort(_('running non-interactively, use %s instead') % + raise error.Abort(_('running non-interactively, use %s instead') % 'commit') opts["interactive"] = True @@ -99,7 +99,7 @@ try: mq = extensions.find('mq') except KeyError: - raise util.Abort(_("'mq' extension not loaded")) + raise error.Abort(_("'mq' extension not loaded")) repo.mq.checkpatchname(patch)
--- a/hgext/relink.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/relink.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ """recreates hardlinks between repository clones""" -from mercurial import cmdutil, hg, util +from mercurial import cmdutil, hg, util, error from mercurial.i18n import _ import os, stat @@ -47,7 +47,7 @@ """ if (not util.safehasattr(util, 'samefile') or not util.safehasattr(util, 'samedevice')): - raise util.Abort(_('hardlinks are not supported on this system')) + raise error.Abort(_('hardlinks are not supported on this system')) src = hg.repository(repo.baseui, ui.expandpath(origin or 'default-relink', origin or 'default')) ui.status(_('relinking %s to %s\n') % (src.store.path, repo.store.path)) @@ -57,7 +57,7 @@ if not util.samedevice(src.store.path, repo.store.path): # No point in continuing - raise util.Abort(_('source and destination are on different devices')) + raise error.Abort(_('source and destination are on different devices')) locallock = repo.lock() try: @@ -114,7 +114,7 @@ return False if not util.samedevice(src, dst): # No point in continuing - raise util.Abort( + raise error.Abort( _('source and destination are on different devices')) if st.st_size != ts.st_size: return False
--- a/hgext/schemes.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/schemes.py Thu Oct 08 12:55:45 2015 -0700 @@ -41,7 +41,7 @@ """ import os, re -from mercurial import extensions, hg, templater, util +from mercurial import extensions, hg, templater, util, error from mercurial.i18n import _ # Note for extension authors: ONLY specify testedwith = 'internal' for @@ -69,7 +69,7 @@ try: url = url.split('://', 1)[1] except IndexError: - raise util.Abort(_("no '://' in scheme url '%s'") % url) + raise error.Abort(_("no '://' in scheme url '%s'") % url) parts = url.split('/', self.parts) if len(parts) > self.parts: tail = parts[-1] @@ -101,7 +101,7 @@ for scheme, url in schemes.items(): if (os.name == 'nt' and len(scheme) == 1 and scheme.isalpha() and os.path.exists('%s:\\' % scheme)): - raise util.Abort(_('custom scheme %s:// conflicts with drive ' + raise error.Abort(_('custom scheme %s:// conflicts with drive ' 'letter %s:\\\n') % (scheme, scheme.upper())) hg.schemes[scheme] = ShortRepository(url, scheme, t)
--- a/hgext/share.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/share.py Thu Oct 08 12:55:45 2015 -0700 @@ -38,7 +38,7 @@ ''' from mercurial.i18n import _ -from mercurial import cmdutil, commands, hg, util, extensions, bookmarks +from mercurial import cmdutil, commands, hg, util, extensions, bookmarks, error from mercurial.hg import repository, parseurl import errno @@ -83,7 +83,7 @@ """ if not repo.shared(): - raise util.Abort(_("this is not a shared repo")) + raise error.Abort(_("this is not a shared repo")) destlock = lock = None lock = repo.lock()
--- a/hgext/shelve.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/shelve.py Thu Oct 08 12:55:45 2015 -0700 @@ -90,7 +90,7 @@ except IOError as err: if err.errno != errno.ENOENT: raise - raise util.Abort(_("shelved change '%s' not found") % self.name) + raise error.Abort(_("shelved change '%s' not found") % self.name) def applybundle(self): fp = self.opener() @@ -135,7 +135,7 @@ version = int(fp.readline().strip()) if version != cls._version: - raise util.Abort(_('this version of shelve is incompatible ' + raise error.Abort(_('this version of shelve is incompatible ' 'with the version used in this repo')) name = fp.readline().strip() wctx = fp.readline().strip() @@ -239,7 +239,7 @@ wctx = repo[None] parents = wctx.parents() if len(parents) > 1: - raise util.Abort(_('cannot shelve while merging')) + raise error.Abort(_('cannot shelve while merging')) parent = parents[0] # we never need the user, so we use a generic user for all shelve operations @@ -290,22 +290,22 @@ if name: if shelvedfile(repo, name, 'hg').exists(): - raise util.Abort(_("a shelved change named '%s' already exists") - % name) + raise error.Abort(_("a shelved change named '%s' already exists" + ) % name) else: for n in gennames(): if not shelvedfile(repo, n, 'hg').exists(): name = n break else: - raise util.Abort(_("too many shelved changes named '%s'") % + raise error.Abort(_("too many shelved changes named '%s'") % label) # ensure we are not creating a subdirectory or a hidden file if '/' in name or '\\' in name: - raise util.Abort(_('shelved change names may not contain slashes')) + raise error.Abort(_('shelved change names may not contain slashes')) if name.startswith('.'): - raise util.Abort(_("shelved change names may not start with '.'")) + raise error.Abort(_("shelved change names may not start with '.'")) interactive = opts.get('interactive', False) def interactivecommitfunc(ui, repo, *pats, **opts): @@ -359,7 +359,7 @@ def deletecmd(ui, repo, pats): """subcommand that deletes a specific shelve""" if not pats: - raise util.Abort(_('no shelved changes specified!')) + raise error.Abort(_('no shelved changes specified!')) wlock = repo.wlock() try: for name in pats: @@ -369,7 +369,7 @@ except OSError as err: if err.errno != errno.ENOENT: raise - raise util.Abort(_("shelved change '%s' not found") % name) + raise error.Abort(_("shelved change '%s' not found") % name) finally: lockmod.release(wlock) @@ -441,18 +441,18 @@ def singlepatchcmds(ui, repo, pats, opts, subcommand): """subcommand that displays a single shelf""" if len(pats) != 1: - raise util.Abort(_("--%s expects a single shelf") % subcommand) + raise error.Abort(_("--%s expects a single shelf") % subcommand) shelfname = pats[0] if not shelvedfile(repo, shelfname, 'patch').exists(): - raise util.Abort(_("cannot find shelf %s") % shelfname) + raise error.Abort(_("cannot find shelf %s") % shelfname) listcmd(ui, repo, pats, opts) def checkparents(repo, state): """check parent while resuming an unshelve""" if state.parents != repo.dirstate.parents(): - raise util.Abort(_('working directory parents do not match unshelve ' + raise error.Abort(_('working directory parents do not match unshelve ' 'state')) def pathtofiles(repo, files): @@ -527,7 +527,7 @@ checkparents(repo, state) ms = merge.mergestate(repo) if [f for f in ms if ms[f] == 'u']: - raise util.Abort( + raise error.Abort( _("unresolved conflicts, can't continue"), hint=_("see 'hg resolve', then 'hg unshelve --continue'")) @@ -610,9 +610,9 @@ if abortf or continuef: if abortf and continuef: - raise util.Abort(_('cannot use both abort and continue')) + raise error.Abort(_('cannot use both abort and continue')) if shelved: - raise util.Abort(_('cannot combine abort/continue with ' + raise error.Abort(_('cannot combine abort/continue with ' 'naming a shelved change')) try: @@ -620,25 +620,25 @@ except IOError as err: if err.errno != errno.ENOENT: raise - raise util.Abort(_('no unshelve operation underway')) + raise error.Abort(_('no unshelve operation underway')) if abortf: return unshelveabort(ui, repo, state, opts) elif continuef: return unshelvecontinue(ui, repo, state, opts) elif len(shelved) > 1: - raise util.Abort(_('can only unshelve one change at a time')) + raise error.Abort(_('can only unshelve one change at a time')) elif not shelved: shelved = listshelves(repo) if not shelved: - raise util.Abort(_('no shelved changes to apply!')) + raise error.Abort(_('no shelved changes to apply!')) basename = util.split(shelved[0][1])[1] ui.status(_("unshelving change '%s'\n") % basename) else: basename = shelved[0] if not shelvedfile(repo, basename, 'patch').exists(): - raise util.Abort(_("shelved change '%s' not found") % basename) + raise error.Abort(_("shelved change '%s' not found") % basename) oldquiet = ui.quiet wlock = lock = tr = None @@ -808,12 +808,12 @@ if opts[opt]: for i, allowable in allowables: if opts[i] and opt not in allowable: - raise util.Abort(_("options '--%s' and '--%s' may not be " + raise error.Abort(_("options '--%s' and '--%s' may not be " "used together") % (opt, i)) return True if checkopt('cleanup'): if pats: - raise util.Abort(_("cannot specify names when using '--cleanup'")) + raise error.Abort(_("cannot specify names when using '--cleanup'")) return cleanupcmd(ui, repo) elif checkopt('delete'): return deletecmd(ui, repo, pats)
--- a/hgext/strip.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/strip.py Thu Oct 08 12:55:45 2015 -0700 @@ -6,7 +6,7 @@ from mercurial.i18n import _ from mercurial.node import nullid from mercurial.lock import release -from mercurial import cmdutil, hg, scmutil, util +from mercurial import cmdutil, hg, scmutil, util, error from mercurial import repair, bookmarks, merge cmdtable = {} @@ -38,10 +38,10 @@ if not force: if s.modified or s.added or s.removed or s.deleted: _("local changes found") # i18n tool detection - raise util.Abort(_("local changes found" + excsuffix)) + raise error.Abort(_("local changes found" + excsuffix)) if checksubstate(repo): _("local changed subrepos found") # i18n tool detection - raise util.Abort(_("local changed subrepos found" + excsuffix)) + raise error.Abort(_("local changed subrepos found" + excsuffix)) return s def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None): @@ -131,7 +131,7 @@ mark = opts.get('bookmark') marks = repo._bookmarks if mark not in marks: - raise util.Abort(_("bookmark '%s' not found") % mark) + raise error.Abort(_("bookmark '%s' not found") % mark) # If the requested bookmark is not the only one pointing to a # a revision we have to only delete the bookmark and not strip @@ -153,7 +153,7 @@ ui.write(_("bookmark '%s' deleted\n") % mark) if not revs: - raise util.Abort(_('empty revision set')) + raise error.Abort(_('empty revision set')) descendants = set(cl.descendants(revs)) strippedrevs = revs.union(descendants)
--- a/hgext/transplant.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/transplant.py Thu Oct 08 12:55:45 2015 -0700 @@ -174,7 +174,7 @@ else: parent = source.lookup(opts['parent']) if parent not in parents: - raise util.Abort(_('%s is not a parent of %s') % + raise error.Abort(_('%s is not a parent of %s') % (short(parent), short(node))) else: parent = parents[0] @@ -245,7 +245,7 @@ environ={'HGUSER': changelog[1], 'HGREVISION': revlog.hex(node), }, - onerr=util.Abort, errprefix=_('filter failed')) + onerr=error.Abort, errprefix=_('filter failed')) user, date, msg = self.parselog(file(headerfile))[1:4] finally: os.unlink(headerfile) @@ -269,7 +269,7 @@ self.ui.note('%s %s\n%s\n' % (user, date, message)) if not patchfile and not merge: - raise util.Abort(_('can only omit patchfile if merging')) + raise error.Abort(_('can only omit patchfile if merging')) if patchfile: try: files = set() @@ -332,14 +332,14 @@ merge = False if not user or not date or not message or not parents[0]: - raise util.Abort(_('transplant log file is corrupt')) + raise error.Abort(_('transplant log file is corrupt')) parent = parents[0] if len(parents) > 1: if opts.get('parent'): parent = source.lookup(opts['parent']) if parent not in parents: - raise util.Abort(_('%s is not a parent of %s') % + raise error.Abort(_('%s is not a parent of %s') % (short(parent), short(node))) else: merge = True @@ -349,7 +349,7 @@ try: p1, p2 = repo.dirstate.parents() if p1 != parent: - raise util.Abort(_('working directory not at transplant ' + raise error.Abort(_('working directory not at transplant ' 'parent %s') % revlog.hex(parent)) if merge: repo.setparents(p1, parents[1]) @@ -358,7 +358,7 @@ n = repo.commit(message, user, date, extra=extra, editor=self.getcommiteditor()) if not n: - raise util.Abort(_('commit failed')) + raise error.Abort(_('commit failed')) if not merge: self.transplants.set(n, node) else: @@ -418,7 +418,7 @@ inmsg = True message.append(line) if None in (user, date): - raise util.Abort(_("filter corrupted changeset (no user or date)")) + raise error.Abort(_("filter corrupted changeset (no user or date)")) return (node, user, date, '\n'.join(message), parents) def log(self, user, date, message, p1, p2, merge=False): @@ -594,18 +594,18 @@ def checkopts(opts, revs): if opts.get('continue'): if opts.get('branch') or opts.get('all') or opts.get('merge'): - raise util.Abort(_('--continue is incompatible with ' + raise error.Abort(_('--continue is incompatible with ' '--branch, --all and --merge')) return if not (opts.get('source') or revs or opts.get('merge') or opts.get('branch')): - raise util.Abort(_('no source URL, branch revision or revision ' + raise error.Abort(_('no source URL, branch revision or revision ' 'list provided')) if opts.get('all'): if not opts.get('branch'): - raise util.Abort(_('--all requires a branch revision')) + raise error.Abort(_('--all requires a branch revision')) if revs: - raise util.Abort(_('--all is incompatible with a ' + raise error.Abort(_('--all is incompatible with a ' 'revision list')) checkopts(opts, revs) @@ -622,13 +622,13 @@ cmdutil.checkunfinished(repo) p1, p2 = repo.dirstate.parents() if len(repo) > 0 and p1 == revlog.nullid: - raise util.Abort(_('no revision checked out')) + raise error.Abort(_('no revision checked out')) if not opts.get('continue'): if p2 != revlog.nullid: - raise util.Abort(_('outstanding uncommitted merges')) + raise error.Abort(_('outstanding uncommitted merges')) m, a, r, d = repo.status()[:4] if m or a or r or d: - raise util.Abort(_('outstanding local changes')) + raise error.Abort(_('outstanding local changes')) sourcerepo = opts.get('source') if sourcerepo:
--- a/hgext/win32mbcs.py Mon Oct 05 22:49:24 2015 -0700 +++ b/hgext/win32mbcs.py Thu Oct 08 12:55:45 2015 -0700 @@ -47,7 +47,7 @@ import os, sys from mercurial.i18n import _ -from mercurial import util, encoding +from mercurial import error, encoding # Note for extension authors: ONLY specify testedwith = 'internal' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -105,7 +105,7 @@ # return value. return enc(func(*dec(args), **dec(kwds))) except UnicodeError: - raise util.Abort(_("[win32mbcs] filename conversion failed with" + raise error.Abort(_("[win32mbcs] filename conversion failed with" " %s encoding\n") % (_encoding)) def wrapper(func, args, kwds):
--- a/mercurial/archival.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/archival.py Thu Oct 08 12:55:45 2015 -0700 @@ -55,7 +55,7 @@ if prefix.startswith('./'): prefix = prefix[2:] if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: - raise util.Abort(_('archive prefix contains illegal components')) + raise error.Abort(_('archive prefix contains illegal components')) return prefix exts = { @@ -292,7 +292,7 @@ if kind == 'files': if prefix: - raise util.Abort(_('cannot give prefix when archiving to files')) + raise error.Abort(_('cannot give prefix when archiving to files')) else: prefix = tidyprefix(dest, kind, prefix) @@ -303,7 +303,7 @@ archiver.addfile(prefix + name, mode, islink, data) if kind not in archivers: - raise util.Abort(_("unknown archive type '%s'") % kind) + raise error.Abort(_("unknown archive type '%s'") % kind) ctx = repo[node] archiver = archivers[kind](dest, mtime or ctx.date()[0])
--- a/mercurial/branchmap.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/branchmap.py Thu Oct 08 12:55:45 2015 -0700 @@ -19,8 +19,8 @@ ) from . import ( encoding, + error, scmutil, - util, ) array = array.array @@ -250,7 +250,7 @@ repo.ui.log('branchcache', 'wrote %s branch cache with %d labels and %d nodes\n', repo.filtername, len(self), nodecount) - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: repo.ui.debug("couldn't write branch cache: %s\n" % inst) # Abort may be raise by read only opener pass @@ -465,7 +465,7 @@ for b in self._names[self._rbcnamescount:])) self._rbcsnameslen = f.tell() f.close() - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: repo.ui.debug("couldn't write revision branch cache names: " "%s\n" % inst) return @@ -483,7 +483,7 @@ end = revs * _rbcrecsize f.write(self._rbcrevs[start:end]) f.close() - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: repo.ui.debug("couldn't write revision branch cache: %s\n" % inst) return
--- a/mercurial/bundle2.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/bundle2.py Thu Oct 08 12:55:45 2015 -0700 @@ -627,10 +627,10 @@ magicstring = changegroup.readexactly(fp, 4) magic, version = magicstring[0:2], magicstring[2:4] if magic != 'HG': - raise util.Abort(_('not a Mercurial bundle')) + raise error.Abort(_('not a Mercurial bundle')) unbundlerclass = formatmap.get(version) if unbundlerclass is None: - raise util.Abort(_('unknown bundle version %s') % version) + raise error.Abort(_('unknown bundle version %s') % version) unbundler = unbundlerclass(ui, fp) indebug(ui, 'start processing of %s stream' % magicstring) return unbundler @@ -1206,7 +1206,7 @@ self._payloadstream = util.chunkbuffer(self._payloadchunks(chunk)) adjust = self.read(internaloffset) if len(adjust) != internaloffset: - raise util.Abort(_('Seek failed\n')) + raise error.Abort(_('Seek failed\n')) self._pos = newpos # These are only the static capabilities. @@ -1304,19 +1304,19 @@ try: raw_url = inpart.params['url'] except KeyError: - raise util.Abort(_('remote-changegroup: missing "%s" param') % 'url') + raise error.Abort(_('remote-changegroup: missing "%s" param') % 'url') parsed_url = util.url(raw_url) if parsed_url.scheme not in capabilities['remote-changegroup']: - raise util.Abort(_('remote-changegroup does not support %s urls') % + raise error.Abort(_('remote-changegroup does not support %s urls') % parsed_url.scheme) try: size = int(inpart.params['size']) except ValueError: - raise util.Abort(_('remote-changegroup: invalid value for param "%s"') + raise error.Abort(_('remote-changegroup: invalid value for param "%s"') % 'size') except KeyError: - raise util.Abort(_('remote-changegroup: missing "%s" param') % 'size') + raise error.Abort(_('remote-changegroup: missing "%s" param') % 'size') digests = {} for typ in inpart.params.get('digests', '').split(): @@ -1324,7 +1324,7 @@ try: value = inpart.params[param] except KeyError: - raise util.Abort(_('remote-changegroup: missing "%s" param') % + raise error.Abort(_('remote-changegroup: missing "%s" param') % param) digests[typ] = value @@ -1339,7 +1339,7 @@ from . import exchange cg = exchange.readbundle(op.repo.ui, real_part, raw_url) if not isinstance(cg, changegroup.cg1unpacker): - raise util.Abort(_('%s: not a bundle version 1.0') % + raise error.Abort(_('%s: not a bundle version 1.0') % util.hidepassword(raw_url)) ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') op.records.add('changegroup', {'return': ret}) @@ -1351,8 +1351,8 @@ part.addparam('return', '%i' % ret, mandatory=False) try: real_part.validate() - except util.Abort as e: - raise util.Abort(_('bundle at %s is corrupted:\n%s') % + except error.Abort as e: + raise error.Abort(_('bundle at %s is corrupted:\n%s') % (util.hidepassword(raw_url), str(e))) assert not inpart.read() @@ -1399,7 +1399,7 @@ @parthandler('error:abort', ('message', 'hint')) def handleerrorabort(op, inpart): """Used to transmit abort error over the wire""" - raise util.Abort(inpart.params['message'], hint=inpart.params.get('hint')) + raise error.Abort(inpart.params['message'], hint=inpart.params.get('hint')) @parthandler('error:pushkey', ('namespace', 'key', 'new', 'old', 'ret', 'in-reply-to'))
--- a/mercurial/bundlerepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/bundlerepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -282,7 +282,7 @@ in changegroup.packermap)] if not cgparts: - raise util.Abort('No changegroups found') + raise error.Abort('No changegroups found') version = cgparts[0].params.get('version', '01') cgparts = [p for p in cgparts if p.params.get('version', '01') == version] @@ -374,7 +374,7 @@ def instance(ui, path, create): if create: - raise util.Abort(_('cannot create new bundle repository')) + raise error.Abort(_('cannot create new bundle repository')) # internal config: bundle.mainreporoot parentpath = ui.config("bundle", "mainreporoot", "") if not parentpath:
--- a/mercurial/changegroup.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/changegroup.py Thu Oct 08 12:55:45 2015 -0700 @@ -37,7 +37,7 @@ '''read n bytes from stream.read and abort if less was available''' s = stream.read(n) if len(s) < n: - raise util.Abort(_("stream ended unexpectedly" + raise error.Abort(_("stream ended unexpectedly" " (got %d bytes, expected %d)") % (len(s), n)) return s @@ -48,7 +48,7 @@ l = struct.unpack(">l", d)[0] if l <= 4: if l: - raise util.Abort(_("invalid chunk length %d") % l) + raise error.Abort(_("invalid chunk length %d") % l) return "" return readexactly(stream, l - 4) @@ -144,12 +144,12 @@ # compression argument is only for the bundle2 case assert compression is None if cg.version != '01': - raise util.Abort(_('old bundle types only supports v1 ' - 'changegroups')) + raise error.Abort(_('old bundle types only supports v1 ' + 'changegroups')) header, comp = bundletypes[bundletype] if comp not in util.compressors: - raise util.Abort(_('unknown stream compression type: %s') - % comp) + raise error.Abort(_('unknown stream compression type: %s') + % comp) z = util.compressors[comp]() subchunkiter = cg.getchunks() def chunkiter(): @@ -175,7 +175,7 @@ if alg == 'UN': alg = None # get more modern without breaking too much if not alg in util.decompressors: - raise util.Abort(_('unknown stream compression type: %s') + raise error.Abort(_('unknown stream compression type: %s') % alg) if alg == 'BZ': alg = '_truncatedBZ' @@ -198,7 +198,7 @@ l = struct.unpack(">l", d)[0] if l <= 4: if l: - raise util.Abort(_("invalid chunk length %d") % l) + raise error.Abort(_("invalid chunk length %d") % l) return 0 if self.callback: self.callback() @@ -477,7 +477,7 @@ for i, fname in enumerate(sorted(changedfiles)): filerevlog = repo.file(fname) if not filerevlog: - raise util.Abort(_("empty or missing revlog for %s") % fname) + raise error.Abort(_("empty or missing revlog for %s") % fname) linkrevnodes = linknodes(filerevlog, fname) # Lookup for filenodes, we collected the linkrev nodes above in the @@ -688,9 +688,9 @@ o = len(fl) try: if not fl.addgroup(source, revmap, trp): - raise util.Abort(_("received file revlog group is empty")) + raise error.Abort(_("received file revlog group is empty")) except error.CensoredBaseError as e: - raise util.Abort(_("received delta base is censored: %s") % e) + raise error.Abort(_("received delta base is censored: %s") % e) revisions += len(fl) - o files += 1 if f in needfiles: @@ -700,7 +700,7 @@ if n in needs: needs.remove(n) else: - raise util.Abort( + raise error.Abort( _("received spurious file revlog entry")) if not needs: del needfiles[f] @@ -712,7 +712,7 @@ try: fl.rev(n) except error.LookupError: - raise util.Abort( + raise error.Abort( _('missing file data for %s:%s - run hg verify') % (f, hex(n))) @@ -784,7 +784,7 @@ efiles = len(efiles) if not (srccontent or emptyok): - raise util.Abort(_("received changelog group is empty")) + raise error.Abort(_("received changelog group is empty")) clend = len(cl) changesets = clend - clstart repo.ui.progress(_('changesets'), None)
--- a/mercurial/cmdutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/cmdutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -85,7 +85,7 @@ msg = _('running non-interactively, use %s instead') % cmdsuggest else: msg = _('running non-interactively') - raise util.Abort(msg) + raise error.Abort(msg) # make sure username is set before going interactive if not opts.get('user'): @@ -109,7 +109,7 @@ checkunfinished(repo, commit=True) merge = len(repo[None].parents()) > 1 if merge: - raise util.Abort(_('cannot partially commit a merge ' + raise error.Abort(_('cannot partially commit a merge ' '(use "hg commit" instead)')) status = repo.status(match=match) @@ -123,7 +123,7 @@ try: chunks = filterfn(ui, originalchunks) except patch.PatchError as err: - raise util.Abort(_('error parsing patch: %s') % err) + raise error.Abort(_('error parsing patch: %s') % err) # We need to keep a backup of files that have been newly added and # modified during the recording process because there is a previous @@ -193,7 +193,7 @@ ui.debug(fp.getvalue()) patch.internalpatch(ui, repo, fp, 1, eolmode=None) except patch.PatchError as err: - raise util.Abort(str(err)) + raise error.Abort(str(err)) del fp # 4. We prepared working directory according to filtered @@ -305,10 +305,10 @@ def bailifchanged(repo, merge=True): if merge and repo.dirstate.p2() != nullid: - raise util.Abort(_('outstanding uncommitted merge')) + raise error.Abort(_('outstanding uncommitted merge')) modified, added, removed, deleted = repo.status()[:4] if modified or added or removed or deleted: - raise util.Abort(_('uncommitted changes')) + raise error.Abort(_('uncommitted changes')) ctx = repo[None] for s in sorted(ctx.substate): ctx.sub(s).bailifchanged() @@ -319,7 +319,7 @@ logfile = opts.get('logfile') if message and logfile: - raise util.Abort(_('options --message and --logfile are mutually ' + raise error.Abort(_('options --message and --logfile are mutually ' 'exclusive')) if not message and logfile: try: @@ -328,7 +328,7 @@ else: message = '\n'.join(util.readfile(logfile).splitlines()) except IOError as inst: - raise util.Abort(_("can't read commit message '%s': %s") % + raise error.Abort(_("can't read commit message '%s': %s") % (logfile, inst.strerror)) return message @@ -387,9 +387,9 @@ try: limit = int(limit) except ValueError: - raise util.Abort(_('limit must be a positive integer')) + raise error.Abort(_('limit must be a positive integer')) if limit <= 0: - raise util.Abort(_('limit must be positive')) + raise error.Abort(_('limit must be positive')) else: limit = None return limit @@ -437,7 +437,7 @@ i += 1 return ''.join(newname) except KeyError as inst: - raise util.Abort(_("invalid format spec '%%%s' in output filename") % + raise error.Abort(_("invalid format spec '%%%s' in output filename") % inst.args[0]) def makefileobj(repo, pat, node=None, desc=None, total=None, @@ -495,7 +495,7 @@ msg = _('cannot specify --changelog or --manifest or --dir ' 'without a repository') if msg: - raise util.Abort(msg) + raise error.Abort(msg) r = None if repo: @@ -503,7 +503,7 @@ r = repo.unfiltered().changelog elif dir: if 'treemanifest' not in repo.requirements: - raise util.Abort(_("--dir can only be used on repos with " + raise error.Abort(_("--dir can only be used on repos with " "treemanifest enabled")) dirlog = repo.dirlog(file_) if len(dirlog): @@ -518,7 +518,7 @@ if not file_: raise error.CommandError(cmd, _('invalid arguments')) if not os.path.isfile(file_): - raise util.Abort(_("revlog '%s' not found") % file_) + raise error.Abort(_("revlog '%s' not found") % file_) r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_[:-2] + ".i") return r @@ -716,17 +716,17 @@ pats = scmutil.expandpats(pats) if not pats: - raise util.Abort(_('no source or destination specified')) + raise error.Abort(_('no source or destination specified')) if len(pats) == 1: - raise util.Abort(_('no destination specified')) + raise error.Abort(_('no destination specified')) dest = pats.pop() destdirexists = os.path.isdir(dest) and not os.path.islink(dest) if not destdirexists: if len(pats) > 1 or matchmod.patkind(pats[0]): - raise util.Abort(_('with multiple sources, destination must be an ' + raise error.Abort(_('with multiple sources, destination must be an ' 'existing directory')) if util.endswithsep(dest): - raise util.Abort(_('destination %s is not a directory') % dest) + raise error.Abort(_('destination %s is not a directory') % dest) tfn = targetpathfn if after: @@ -738,7 +738,7 @@ continue copylist.append((tfn(pat, dest, srcs), srcs)) if not copylist: - raise util.Abort(_('no files to copy')) + raise error.Abort(_('no files to copy')) errors = 0 for targetpath, srcs in copylist: @@ -786,7 +786,7 @@ return not os.path.exists(lockpath) pid = util.rundetached(runargs, condfn) if pid < 0: - raise util.Abort(_('child process failed to start')) + raise error.Abort(_('child process failed to start')) writepid(pid) finally: try: @@ -908,7 +908,7 @@ parents.append(repo[nullid]) if opts.get('exact'): if not nodeid or not p1: - raise util.Abort(_('not a Mercurial patch')) + raise error.Abort(_('not a Mercurial patch')) p1 = repo[p1] p2 = repo[p2 or nullid] elif p2: @@ -946,7 +946,7 @@ files=files, eolmode=None, similarity=sim / 100.0) except patch.PatchError as e: if not partial: - raise util.Abort(str(e)) + raise error.Abort(str(e)) if partial: rejects = True @@ -993,7 +993,7 @@ patch.patchrepo(ui, repo, p1, store, tmpname, strip, prefix, files, eolmode=None) except patch.PatchError as e: - raise util.Abort(str(e)) + raise error.Abort(str(e)) if opts.get('exact'): editor = None else: @@ -1012,7 +1012,7 @@ # and branch bits ui.warn(_("warning: can't check exact import with --no-commit\n")) elif opts.get('exact') and hex(n) != nodeid: - raise util.Abort(_('patch is damaged or loses information')) + raise error.Abort(_('patch is damaged or loses information')) if n: # i18n: refers to a short changeset id msg = _('created %s') % short(n) @@ -1500,9 +1500,9 @@ self.t(self._parts['footer'], **props)) except KeyError as inst: msg = _("%s: no key named '%s'") - raise util.Abort(msg % (self.t.mapfile, inst.args[0])) + raise error.Abort(msg % (self.t.mapfile, inst.args[0])) except SyntaxError as inst: - raise util.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) + raise error.Abort('%s: %s' % (self.t.mapfile, inst.args[0])) def gettemplate(ui, tmpl, style): """ @@ -1563,7 +1563,7 @@ t = changeset_templater(ui, repo, matchfn, opts, tmpl, mapfile, buffered) except SyntaxError as inst: - raise util.Abort(inst.args[0]) + raise error.Abort(inst.args[0]) return t def showmarker(ui, marker): @@ -1603,7 +1603,7 @@ (rev, util.datestr(results[rev]))) return str(rev) - raise util.Abort(_("revision matching date not found")) + raise error.Abort(_("revision matching date not found")) def increasingwindows(windowsize=8, sizelimit=512): while True: @@ -1658,7 +1658,7 @@ for filename in match.files(): if follow: if filename not in pctx: - raise util.Abort(_('cannot follow file not in parent ' + raise error.Abort(_('cannot follow file not in parent ' 'revision: "%s"') % filename) yield filename, pctx[filename].filenode() else: @@ -1673,7 +1673,7 @@ # A zero count may be a directory or deleted file, so # try to find matching entries on the slow path. if follow: - raise util.Abort( + raise error.Abort( _('cannot follow nonexistent file: "%s"') % file_) raise FileWalkError("Cannot walk via filelog") else: @@ -1804,7 +1804,7 @@ # changed files if follow: - raise util.Abort(_('can only follow copies/renames for explicit ' + raise error.Abort(_('can only follow copies/renames for explicit ' 'filenames')) # The slow path checks files modified in every changeset. @@ -1976,14 +1976,14 @@ slowpath = True continue else: - raise util.Abort(_('cannot follow file not in parent ' + raise error.Abort(_('cannot follow file not in parent ' 'revision: "%s"') % f) filelog = repo.file(f) if not filelog: # A zero count may be a directory or deleted file, so # try to find matching entries on the slow path. if follow: - raise util.Abort( + raise error.Abort( _('cannot follow nonexistent file: "%s"') % f) slowpath = True @@ -2207,7 +2207,7 @@ def checkunsupportedgraphflags(pats, opts): for op in ["newest_first"]: if op in opts and opts[op]: - raise util.Abort(_("-G/--graph option is incompatible with --%s") + raise error.Abort(_("-G/--graph option is incompatible with --%s") % op.replace("_", "-")) def graphrevs(repo, nodes, opts): @@ -2485,7 +2485,7 @@ # that doesn't support addremove if opts.get('addremove'): if scmutil.addremove(repo, matcher, "", opts) != 0: - raise util.Abort( + raise error.Abort( _("failed to mark all new/missing files as added/removed")) return commitfunc(ui, repo, message, matcher, opts) @@ -2719,7 +2719,7 @@ if finishdesc: text = finishdesc(text) if not text.strip(): - raise util.Abort(_("empty commit message")) + raise error.Abort(_("empty commit message")) return text @@ -2730,7 +2730,7 @@ try: t = changeset_templater(ui, repo, None, {}, tmpl, mapfile, False) except SyntaxError as inst: - raise util.Abort(inst.args[0]) + raise error.Abort(inst.args[0]) for k, v in repo.ui.configitems('committemplate'): if k != 'changeset': @@ -3097,7 +3097,7 @@ try: wctx.sub(sub).revert(ctx.substate[sub], *pats, **opts) except KeyError: - raise util.Abort("subrepository '%s' does not exist in %s!" + raise error.Abort("subrepository '%s' does not exist in %s!" % (sub, short(ctx.node()))) finally: wlock.release() @@ -3168,7 +3168,7 @@ chunks = patch.reversehunks(chunks) except patch.PatchError as err: - raise util.Abort(_('error parsing patch: %s') % err) + raise error.Abort(_('error parsing patch: %s') % err) newlyaddedandmodifiedfiles = newandmodified(chunks, originalchunks) # Apply changes @@ -3181,7 +3181,7 @@ try: patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None) except patch.PatchError as err: - raise util.Abort(str(err)) + raise error.Abort(str(err)) del fp else: for f in actions['revert'][0]: @@ -3302,7 +3302,7 @@ if commit and allowcommit: continue if repo.vfs.exists(f): - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) def clearunfinished(repo): '''Check for unfinished operations (as above), and clear the ones @@ -3310,7 +3310,7 @@ ''' for f, clearable, allowcommit, msg, hint in unfinishedstates: if not clearable and repo.vfs.exists(f): - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) for f, clearable, allowcommit, msg, hint in unfinishedstates: if clearable and repo.vfs.exists(f): util.unlink(repo.join(f)) @@ -3349,7 +3349,7 @@ if not self._active: # already inactivated msg = (_("can't close already inactivated backup: %s") % self._filename) - raise util.Abort(msg) + raise error.Abort(msg) self._repo.vfs.unlink(self._filename) self._active = False @@ -3368,7 +3368,7 @@ if not self._active: # already inactivated msg = (_("can't release already inactivated backup: %s") % self._filename) - raise util.Abort(msg) + raise error.Abort(msg) self._abort() _bundlecompspecs = {'none': None, @@ -3402,7 +3402,7 @@ elif spec in _bundleversionspecs: version = spec else: - raise util.Abort(_('unknown bundle type specified with --type')) + raise error.Abort(_('unknown bundle type specified with --type')) if comp is None: comp = 'BZ' @@ -3410,7 +3410,7 @@ try: comp = _bundlecompspecs[comp] except KeyError: - raise util.Abort(_('unknown bundle type specified with --type')) + raise error.Abort(_('unknown bundle type specified with --type')) if version is None: version = '01' @@ -3420,6 +3420,6 @@ try: version = _bundleversionspecs[version] except KeyError: - raise util.Abort(_('unknown bundle type specified with --type')) + raise error.Abort(_('unknown bundle type specified with --type')) return version, comp
--- a/mercurial/commands.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/commands.py Thu Oct 08 12:55:45 2015 -0700 @@ -238,9 +238,9 @@ try: sim = float(opts.get('similarity') or 100) except ValueError: - raise util.Abort(_('similarity must be a number')) + raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: - raise util.Abort(_('similarity must be between 0 and 100')) + raise error.Abort(_('similarity must be between 0 and 100')) matcher = scmutil.match(repo[None], pats, opts) return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) @@ -276,7 +276,7 @@ Returns 0 on success. """ if not pats: - raise util.Abort(_('at least one filename or pattern is required')) + raise error.Abort(_('at least one filename or pattern is required')) if opts.get('follow'): # --follow is deprecated and now just an alias for -f/--file @@ -333,7 +333,7 @@ linenumber = opts.get('line_number') is not None if linenumber and (not opts.get('changeset')) and (not opts.get('number')): - raise util.Abort(_('at least one of -n/-c is required for -l')) + raise error.Abort(_('at least one of -n/-c is required for -l')) if fm: def makefunc(get, fmt): @@ -348,7 +348,7 @@ if opts.get(op)) def bad(x, y): - raise util.Abort("%s: %s" % (x, y)) + raise error.Abort("%s: %s" % (x, y)) m = scmutil.match(ctx, pats, opts, badfn=bad) @@ -438,18 +438,18 @@ ctx = scmutil.revsingle(repo, opts.get('rev')) if not ctx: - raise util.Abort(_('no working directory: please specify a revision')) + raise error.Abort(_('no working directory: please specify a revision')) node = ctx.node() dest = cmdutil.makefilename(repo, dest, node) if os.path.realpath(dest) == repo.root: - raise util.Abort(_('repository root cannot be destination')) + raise error.Abort(_('repository root cannot be destination')) kind = opts.get('type') or archival.guesskind(dest) or 'files' prefix = opts.get('prefix') if dest == '-': if kind == 'files': - raise util.Abort(_('cannot archive plain files to stdout')) + raise error.Abort(_('cannot archive plain files to stdout')) dest = cmdutil.makefileobj(repo, dest) if not prefix: prefix = os.path.basename(repo.root) + '-%h' @@ -504,13 +504,13 @@ files. ''' if rev and node: - raise util.Abort(_("please specify just one revision")) + raise error.Abort(_("please specify just one revision")) if not rev: rev = node if not rev: - raise util.Abort(_("please specify a revision to backout")) + raise error.Abort(_("please specify a revision to backout")) date = opts.get('date') if date: @@ -522,22 +522,22 @@ op1, op2 = repo.dirstate.parents() if not repo.changelog.isancestor(node, op1): - raise util.Abort(_('cannot backout change that is not an ancestor')) + raise error.Abort(_('cannot backout change that is not an ancestor')) p1, p2 = repo.changelog.parents(node) if p1 == nullid: - raise util.Abort(_('cannot backout a change with no parents')) + raise error.Abort(_('cannot backout a change with no parents')) if p2 != nullid: if not opts.get('parent'): - raise util.Abort(_('cannot backout a merge changeset')) + raise error.Abort(_('cannot backout a merge changeset')) p = repo.lookup(opts['parent']) if p not in (p1, p2): - raise util.Abort(_('%s is not a parent of %s') % + raise error.Abort(_('%s is not a parent of %s') % (short(p), short(node))) parent = p else: if opts.get('parent'): - raise util.Abort(_('cannot use --parent on non-merge changeset')) + raise error.Abort(_('cannot use --parent on non-merge changeset')) parent = p1 # the backout should appear on the same branch @@ -746,9 +746,9 @@ if (good or bad or skip or reset) and interactive: return if not state['good']: - raise util.Abort(_('cannot bisect (no known good revisions)')) + raise error.Abort(_('cannot bisect (no known good revisions)')) else: - raise util.Abort(_('cannot bisect (no known bad revisions)')) + raise error.Abort(_('cannot bisect (no known bad revisions)')) return True # backward compatibility @@ -762,7 +762,7 @@ else: reset = True elif extra or good + bad + skip + reset + extend + bool(command) > 1: - raise util.Abort(_('incompatible arguments')) + raise error.Abort(_('incompatible arguments')) cmdutil.checkunfinished(repo) @@ -780,12 +780,12 @@ try: node = state['current'][0] except LookupError: - raise util.Abort(_('current bisect revision is unknown - ' + raise error.Abort(_('current bisect revision is unknown - ' 'start a new bisect to fix')) else: node, p2 = repo.dirstate.parents() if p2 != nullid: - raise util.Abort(_('current bisect revision is a merge')) + raise error.Abort(_('current bisect revision is a merge')) try: while changesets: # update state @@ -798,9 +798,9 @@ transition = "good" # status < 0 means process was killed elif status == 127: - raise util.Abort(_("failed to execute %s") % command) + raise error.Abort(_("failed to execute %s") % command) elif status < 0: - raise util.Abort(_("%s killed") % command) + raise error.Abort(_("%s killed") % command) else: transition = "bad" ctx = scmutil.revsingle(repo, rev, node) @@ -854,7 +854,7 @@ return cmdutil.bailifchanged(repo) return hg.clean(repo, extendnode.node()) - raise util.Abort(_("nothing to extend")) + raise error.Abort(_("nothing to extend")) if changesets == 0: print_result(nodes, good) @@ -937,7 +937,7 @@ def checkformat(mark): mark = mark.strip() if not mark: - raise util.Abort(_("bookmark names cannot consist entirely of " + raise error.Abort(_("bookmark names cannot consist entirely of " "whitespace")) scmutil.checknewlabel(repo, mark, 'bookmark') return mark @@ -967,21 +967,21 @@ ui.status(_("moving bookmark '%s' forward from %s\n") % (mark, short(bmctx.node()))) return - raise util.Abort(_("bookmark '%s' already exists " + raise error.Abort(_("bookmark '%s' already exists " "(use -f to force)") % mark) if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) and not force): - raise util.Abort( + raise error.Abort( _("a bookmark cannot have the name of an existing branch")) if delete and rename: - raise util.Abort(_("--delete and --rename are incompatible")) + raise error.Abort(_("--delete and --rename are incompatible")) if delete and rev: - raise util.Abort(_("--rev is incompatible with --delete")) + raise error.Abort(_("--rev is incompatible with --delete")) if rename and rev: - raise util.Abort(_("--rev is incompatible with --rename")) + raise error.Abort(_("--rev is incompatible with --rename")) if not names and (delete or rev): - raise util.Abort(_("bookmark name required")) + raise error.Abort(_("bookmark name required")) if delete or rename or names or inactive: wlock = lock = tr = None @@ -994,7 +994,7 @@ tr = repo.transaction('bookmark') for mark in names: if mark not in marks: - raise util.Abort(_("bookmark '%s' does not exist") % + raise error.Abort(_("bookmark '%s' does not exist") % mark) if mark == repo._activebookmark: bookmarks.deactivate(repo) @@ -1003,12 +1003,13 @@ elif rename: tr = repo.transaction('bookmark') if not names: - raise util.Abort(_("new bookmark name required")) + raise error.Abort(_("new bookmark name required")) elif len(names) > 1: - raise util.Abort(_("only one new bookmark name allowed")) + raise error.Abort(_("only one new bookmark name allowed")) mark = checkformat(names[0]) if rename not in marks: - raise util.Abort(_("bookmark '%s' does not exist") % rename) + raise error.Abort(_("bookmark '%s' does not exist") + % rename) checkconflict(repo, mark, cur, force) marks[mark] = marks[rename] if repo._activebookmark == rename and not inactive: @@ -1119,7 +1120,7 @@ elif label: if not opts.get('force') and label in repo.branchmap(): if label not in [p.branch() for p in repo.parents()]: - raise util.Abort(_('a branch of the same name already' + raise error.Abort(_('a branch of the same name already' ' exists'), # i18n: "it" refers to an existing branch hint=_("use 'hg update' to switch to it")) @@ -1251,7 +1252,7 @@ bundlecaps = None if base: if dest: - raise util.Abort(_("--base is incompatible with specifying " + raise error.Abort(_("--base is incompatible with specifying " "a destination")) common = [repo.lookup(rev) for rev in base] heads = revs and map(repo.lookup, revs) or revs @@ -1429,7 +1430,7 @@ Returns 0 on success. """ if opts.get('noupdate') and opts.get('updaterev'): - raise util.Abort(_("cannot specify both --noupdate and --updaterev")) + raise error.Abort(_("cannot specify both --noupdate and --updaterev")) r = hg.clone(ui, opts, source, dest, pull=opts.get('pull'), @@ -1501,7 +1502,7 @@ if opts.get('subrepos'): if opts.get('amend'): - raise util.Abort(_('cannot amend with --subrepos')) + raise error.Abort(_('cannot amend with --subrepos')) # Let --subrepos on the command line override config setting. ui.setconfig('ui', 'commitsubrepos', True, 'commit') @@ -1515,24 +1516,24 @@ extra['close'] = 1 if not bheads: - raise util.Abort(_('can only close branch heads')) + raise error.Abort(_('can only close branch heads')) elif opts.get('amend'): if repo.parents()[0].p1().branch() != branch and \ repo.parents()[0].p2().branch() != branch: - raise util.Abort(_('can only close branch heads')) + raise error.Abort(_('can only close branch heads')) if opts.get('amend'): if ui.configbool('ui', 'commitsubrepos'): - raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) + raise error.Abort(_('cannot amend with ui.commitsubrepos enabled')) old = repo['.'] if not old.mutable(): - raise util.Abort(_('cannot amend public changesets')) + raise error.Abort(_('cannot amend public changesets')) if len(repo[None].parents()) > 1: - raise util.Abort(_('cannot amend while merging')) + raise error.Abort(_('cannot amend while merging')) allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) if not allowunstable and old.children(): - raise util.Abort(_('cannot amend changeset with children')) + raise error.Abort(_('cannot amend changeset with children')) # commitfunc is used only for temporary amend commit by cmdutil.amend def commitfunc(ui, repo, message, match, opts): @@ -1614,11 +1615,11 @@ if opts.get('edit') or opts.get('local') or opts.get('global'): if opts.get('local') and opts.get('global'): - raise util.Abort(_("can't use --local and --global together")) + raise error.Abort(_("can't use --local and --global together")) if opts.get('local'): if not repo: - raise util.Abort(_("can't use --local outside a repository")) + raise error.Abort(_("can't use --local outside a repository")) paths = [repo.join('hgrc')] elif opts.get('global'): paths = scmutil.systemrcpath() @@ -1643,7 +1644,7 @@ editor = ui.geteditor() ui.system("%s \"%s\"" % (editor, f), - onerr=util.Abort, errprefix=_("edit failed")) + onerr=error.Abort, errprefix=_("edit failed")) return for f in scmutil.rcpath(): @@ -1653,7 +1654,7 @@ sections = [v for v in values if '.' not in v] items = [v for v in values if '.' in v] if len(items) > 1 or items and sections: - raise util.Abort(_('only one config item permitted')) + raise error.Abort(_('only one config item permitted')) matched = False for section, name, value in ui.walkconfig(untrusted=untrusted): value = str(value).replace('\n', '\\n') @@ -1715,13 +1716,13 @@ lookup = r.lookup elif len(args) == 2: if not repo: - raise util.Abort(_("there is no Mercurial repository here " + raise error.Abort(_("there is no Mercurial repository here " "(.hg not found)")) rev1, rev2 = args r = repo.changelog lookup = repo.lookup else: - raise util.Abort(_('either two or three arguments required')) + raise error.Abort(_('either two or three arguments required')) a = r.ancestor(lookup(rev1), lookup(rev2)) ui.write("%d:%s\n" % (r.rev(a), hex(a))) @@ -1772,7 +1773,7 @@ cl = repo.changelog if len(cl) > 0: - raise util.Abort(_('repository is not empty')) + raise error.Abort(_('repository is not empty')) # determine number of revs in DAG total = 0 @@ -1920,7 +1921,7 @@ showchunks(fname) else: if isinstance(gen, bundle2.unbundle20): - raise util.Abort(_('use debugbundle2 for this file')) + raise error.Abort(_('use debugbundle2 for this file')) chunkdata = gen.changelogheader() chain = None while True: @@ -1936,7 +1937,7 @@ def _debugbundle2(ui, gen, **opts): """lists the contents of a bundle2""" if not isinstance(gen, bundle2.unbundle20): - raise util.Abort(_('not a bundle2 file')) + raise error.Abort(_('not a bundle2 file')) ui.write(('Stream params: %s\n' % repr(gen.params))) for part in gen.iterparts(): ui.write('%s -- %r\n' % (part.type, repr(part.params))) @@ -1979,7 +1980,7 @@ errors += 1 if errors: error = _(".hg/dirstate inconsistent with current parent's manifest") - raise util.Abort(error) + raise error.Abort(error) @command('debugcommands', [], _('[COMMAND]'), norepo=True) def debugcommands(ui, cmd='', *args): @@ -2067,7 +2068,7 @@ for l in ls: yield 'l', (r, l) else: - raise util.Abort(_('need repo for changelog dag')) + raise error.Abort(_('need repo for changelog dag')) for line in dagparser.dagtextlines(events(), addspaces=spaces, @@ -2094,7 +2095,7 @@ try: ui.write(r.revision(r.lookup(rev))) except KeyError: - raise util.Abort(_('invalid revision identifier %s') % rev) + raise error.Abort(_('invalid revision identifier %s') % rev) @command('debugdate', [('e', 'extended', None, _('try extended date formats'))], @@ -2131,7 +2132,7 @@ def doit(localheads, remoteheads, remote=remote): if opts.get('old'): if localheads: - raise util.Abort('cannot use localheads with old style ' + raise error.Abort('cannot use localheads with old style ' 'discovery') if not util.safehasattr(remote, 'branches'): # enable in-client legacy support @@ -2259,7 +2260,7 @@ """ repo = hg.peer(ui, opts, repopath) if not repo.capable('getbundle'): - raise util.Abort("getbundle() not supported by target repository") + raise error.Abort("getbundle() not supported by target repository") args = {} if common: args['common'] = [bin(s) for s in common] @@ -2276,7 +2277,7 @@ 'bundle2': 'HG20'} bundletype = btypes.get(bundletype) if bundletype not in changegroup.bundletypes: - raise util.Abort(_('unknown bundle type specified with --type')) + raise error.Abort(_('unknown bundle type specified with --type')) changegroup.writebundle(ui, bundle, bundlepath, bundletype) @command('debugignore', [], '') @@ -2287,7 +2288,7 @@ if includepat is not None: ui.write("%s\n" % includepat) else: - raise util.Abort(_("no ignore patterns found")) + raise error.Abort(_("no ignore patterns found")) @command('debugindex', [('c', 'changelog', False, _('open changelog')), @@ -2301,7 +2302,7 @@ r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) format = opts.get('format', 0) if format not in (0, 1): - raise util.Abort(_("unknown format %d") % format) + raise error.Abort(_("unknown format %d") % format) generaldelta = r.version & revlog.REVLOGGENERALDELTA if generaldelta: @@ -2387,7 +2388,7 @@ ui.status(_("checking encoding (%s)...\n") % encoding.encoding) try: encoding.fromlocal("test") - except util.Abort as inst: + except error.Abort as inst: ui.write(" %s\n" % inst) ui.write(_(" (check that your locale is properly set)\n")) problems += 1 @@ -2453,7 +2454,7 @@ ui.status(_("checking username...\n")) try: ui.username() - except util.Abort as e: + except error.Abort as e: ui.write(" %s\n" % e) ui.write(_(" (specify a username in your configuration file)\n")) problems += 1 @@ -2475,7 +2476,7 @@ """ repo = hg.peer(ui, opts, repopath) if not repo.capable('known'): - raise util.Abort("known() not supported by target repository") + raise error.Abort("known() not supported by target repository") flags = repo.known([bin(s) for s in ids]) ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) @@ -2663,12 +2664,12 @@ raise TypeError() return n except TypeError: - raise util.Abort('changeset references must be full hexadecimal ' + raise error.Abort('changeset references must be full hexadecimal ' 'node identifiers') if precursor is not None: if opts['rev']: - raise util.Abort('cannot select revision when creating marker') + raise error.Abort('cannot select revision when creating marker') metadata = {} metadata['user'] = opts['user'] or ui.username() succs = tuple(parsenodeid(succ) for succ in successors) @@ -2685,7 +2686,7 @@ parents = None if opts['record_parents']: if prec not in repo.unfiltered(): - raise util.Abort('cannot used --record-parents on ' + raise error.Abort('cannot used --record-parents on ' 'unknown changesets') parents = repo.unfiltered()[prec].parents() parents = tuple(p.node() for p in parents) @@ -2694,7 +2695,7 @@ metadata=metadata) tr.close() except ValueError as exc: - raise util.Abort(_('bad obsmarker input: %s') % exc) + raise error.Abort(_('bad obsmarker input: %s') % exc) finally: tr.release() finally: @@ -3319,7 +3320,7 @@ if revs and change: msg = _('cannot specify --rev and --change at the same time') - raise util.Abort(msg) + raise error.Abort(msg) elif change: node2 = scmutil.revsingle(repo, change, None).node() node1 = repo[node2].p1().node() @@ -3407,7 +3408,7 @@ changesets = ['.'] revs = scmutil.revrange(repo, changesets) if not revs: - raise util.Abort(_("export requires at least one changeset")) + raise error.Abort(_("export requires at least one changeset")) if len(revs) > 1: ui.note(_('exporting patches:\n')) else: @@ -3511,7 +3512,7 @@ """ if not pats: - raise util.Abort(_('no files specified')) + raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] @@ -3602,7 +3603,7 @@ if opts['continue']: cont = True if revs: - raise util.Abort(_("can't specify --continue and revisions")) + raise error.Abort(_("can't specify --continue and revisions")) # read in unfinished revisions try: nodes = repo.vfs.read('graftstate').splitlines() @@ -3610,12 +3611,12 @@ except IOError as inst: if inst.errno != errno.ENOENT: raise - raise util.Abort(_("no graft state found, can't continue")) + raise error.Abort(_("no graft state found, can't continue")) else: cmdutil.checkunfinished(repo) cmdutil.bailifchanged(repo) if not revs: - raise util.Abort(_('no revisions specified')) + raise error.Abort(_('no revisions specified')) revs = scmutil.revrange(repo, revs) skipped = set() @@ -3738,7 +3739,7 @@ # write out state for --continue nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] repo.vfs.write('graftstate', ''.join(nodelines)) - raise util.Abort( + raise error.Abort( _("unresolved conflicts, can't continue"), hint=_('use hg resolve and hg graft --continue')) else: @@ -4101,7 +4102,7 @@ # to look for, or we could have simply failed to found "foo.bar" # because bar isn't a section of foo if section and not (formatted and name): - raise util.Abort(_("help section not found")) + raise error.Abort(_("help section not found")) if 'verbose' in pruned: keep.append('omitted') @@ -4158,7 +4159,7 @@ """ if not repo and not source: - raise util.Abort(_("there is no Mercurial repository here " + raise error.Abort(_("there is no Mercurial repository here " "(.hg not found)")) if ui.debugflag: @@ -4177,7 +4178,7 @@ if not repo: if num or branch or tags: - raise util.Abort( + raise error.Abort( _("can't query remote revision number, branch, or tags")) if not rev and revs: rev = revs[0] @@ -4370,7 +4371,7 @@ """ if not patch1: - raise util.Abort(_('need at least one patch to import')) + raise error.Abort(_('need at least one patch to import')) patches = (patch1,) + patches @@ -4380,19 +4381,19 @@ update = not opts.get('bypass') if not update and opts.get('no_commit'): - raise util.Abort(_('cannot use --no-commit with --bypass')) + raise error.Abort(_('cannot use --no-commit with --bypass')) try: sim = float(opts.get('similarity') or 0) except ValueError: - raise util.Abort(_('similarity must be a number')) + raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: - raise util.Abort(_('similarity must be between 0 and 100')) + raise error.Abort(_('similarity must be between 0 and 100')) if sim and not update: - raise util.Abort(_('cannot use --similarity with --bypass')) + raise error.Abort(_('cannot use --similarity with --bypass')) if opts.get('exact') and opts.get('edit'): - raise util.Abort(_('cannot use --exact with --edit')) + raise error.Abort(_('cannot use --exact with --edit')) if opts.get('exact') and opts.get('prefix'): - raise util.Abort(_('cannot use --exact with --prefix')) + raise error.Abort(_('cannot use --exact with --prefix')) if update: cmdutil.checkunfinished(repo) @@ -4444,7 +4445,7 @@ break if not haspatch: - raise util.Abort(_('%s: no diffs found') % patchurl) + raise error.Abort(_('%s: no diffs found') % patchurl) if tr: tr.close() @@ -4540,7 +4541,7 @@ return 0 if opts.get('bundle') and opts.get('subrepos'): - raise util.Abort(_('cannot combine --bundle and --subrepos')) + raise error.Abort(_('cannot combine --bundle and --subrepos')) if opts.get('bookmarks'): source, branches = hg.parseurl(ui.expandpath(source), @@ -4806,7 +4807,7 @@ if opts.get('all'): if rev or node: - raise util.Abort(_("can't specify a revision with --all")) + raise error.Abort(_("can't specify a revision with --all")) res = [] prefix = "data/" @@ -4827,7 +4828,7 @@ return if rev and node: - raise util.Abort(_("please specify just one revision")) + raise error.Abort(_("please specify just one revision")) if not node: node = rev @@ -4882,7 +4883,7 @@ """ if opts.get('rev') and node: - raise util.Abort(_("please specify just one revision")) + raise error.Abort(_("please specify just one revision")) if not node: node = opts.get('rev') @@ -5012,7 +5013,7 @@ if file_: m = scmutil.match(ctx, (file_,), opts) if m.anypats() or len(m.files()) != 1: - raise util.Abort(_('can only specify an explicit filename')) + raise error.Abort(_('can only specify an explicit filename')) file_ = m.files()[0] filenodes = [] for cp in ctx.parents(): @@ -5023,7 +5024,7 @@ except error.LookupError: pass if not filenodes: - raise util.Abort(_("'%s' not found in manifest!") % file_) + raise error.Abort(_("'%s' not found in manifest!") % file_) p = [] for fn in filenodes: fctx = repo.filectx(file_, fileid=fn) @@ -5112,7 +5113,7 @@ for idx, name in enumerate(phases.phasenames): if opts[name]: if targetphase is not None: - raise util.Abort(_('only one phase can be specified')) + raise error.Abort(_('only one phase can be specified')) targetphase = idx # look for specified revision @@ -5139,7 +5140,7 @@ tr = repo.transaction("phase") # set phase if not revs: - raise util.Abort(_('empty revision set')) + raise error.Abort(_('empty revision set')) nodes = [repo[r].node() for r in revs] # moving revision from public to draft may hide them # We have to check result on an unfiltered repository @@ -5181,7 +5182,7 @@ checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) try: ret = hg.update(repo, checkout) - except util.Abort as inst: + except error.Abort as inst: ui.warn(_("not updating: %s\n") % str(inst)) if inst.hint: ui.warn(_("(%s)\n") % inst.hint) @@ -5252,7 +5253,7 @@ pullopargs['remotebookmarks'] = remotebookmarks for b in opts['bookmark']: if b not in remotebookmarks: - raise util.Abort(_('remote bookmark %s not found!') % b) + raise error.Abort(_('remote bookmark %s not found!') % b) revs.append(remotebookmarks[b]) if revs: @@ -5270,7 +5271,7 @@ except error.CapabilityError: err = _("other repository doesn't support revision lookup, " "so a rev cannot be specified.") - raise util.Abort(err) + raise error.Abort(err) modheads = exchange.pull(repo, other, heads=revs, force=opts.get('force'), @@ -5350,7 +5351,7 @@ path = ui.paths.getpath(dest, default='default') if not path: - raise util.Abort(_('default repository not configured!'), + raise error.Abort(_('default repository not configured!'), hint=_('see the "path" section in "hg help config"')) dest, branches = path.pushloc, (path.branch, opts.get('branch') or []) ui.status(_('pushing to %s\n') % util.hidepassword(dest)) @@ -5360,7 +5361,7 @@ if revs: revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] if not revs: - raise util.Abort(_("specified revisions evaluate to an empty set"), + raise error.Abort(_("specified revisions evaluate to an empty set"), hint=_("use different revision arguments")) repo._subtoppath = dest @@ -5450,7 +5451,7 @@ after, force = opts.get('after'), opts.get('force') if not pats and not after: - raise util.Abort(_('no files specified')) + raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) subrepos = opts.get('subrepos') @@ -5534,11 +5535,11 @@ [opts.get(o) for o in 'all mark unmark list no_status'.split()] if (show and (mark or unmark)) or (mark and unmark): - raise util.Abort(_("too many options specified")) + raise error.Abort(_("too many options specified")) if pats and all: - raise util.Abort(_("can't specify --all and patterns")) + raise error.Abort(_("can't specify --all and patterns")) if not (all or pats or show or mark or unmark): - raise util.Abort(_('no files or directories specified'), + raise error.Abort(_('no files or directories specified'), hint=('use --all to re-merge all unresolved files')) if show: @@ -5560,7 +5561,7 @@ ms = mergemod.mergestate(repo) if not (ms.active() or repo.dirstate.p2() != nullid): - raise util.Abort( + raise error.Abort( _('resolve command not applicable when not merging')) m = scmutil.match(repo[None], pats, opts) @@ -5656,13 +5657,13 @@ if opts.get("date"): if opts.get("rev"): - raise util.Abort(_("you can't specify a revision and a date")) + raise error.Abort(_("you can't specify a revision and a date")) opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) parent, p2 = repo.dirstate.parents() if not opts.get('rev') and p2 != nullid: # revert after merge is a trap for new users (issue2915) - raise util.Abort(_('uncommitted merge with no revision specified'), + raise error.Abort(_('uncommitted merge with no revision specified'), hint=_('use "hg update" or see "hg help revert"')) ctx = scmutil.revsingle(repo, opts.get('rev')) @@ -5673,7 +5674,7 @@ if p2 != nullid: hint = _("uncommitted merge, use --all to discard all changes," " or 'hg update -C .' to abort the merge") - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) dirty = any(repo.status()) node = ctx.node() if node != parent: @@ -5687,7 +5688,7 @@ hint = _("uncommitted changes, use --all to discard all changes") else: hint = _("use --all to revert all files") - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) @@ -5799,7 +5800,7 @@ """ if opts["stdio"] and opts["cmdserver"]: - raise util.Abort(_("cannot use --stdio with --cmdserver")) + raise error.Abort(_("cannot use --stdio with --cmdserver")) if opts["stdio"]: if repo is None: @@ -5968,7 +5969,7 @@ if revs and change: msg = _('cannot specify --rev and --change at the same time') - raise util.Abort(msg) + raise error.Abort(msg) elif change: node2 = scmutil.revsingle(repo, change, None).node() node1 = repo[node2].p1().node() @@ -6320,14 +6321,14 @@ rev_ = "." names = [t.strip() for t in (name1,) + names] if len(names) != len(set(names)): - raise util.Abort(_('tag names must be unique')) + raise error.Abort(_('tag names must be unique')) for n in names: scmutil.checknewlabel(repo, n, 'tag') if not n: - raise util.Abort(_('tag names cannot consist entirely of ' + raise error.Abort(_('tag names cannot consist entirely of ' 'whitespace')) if opts.get('rev') and opts.get('remove'): - raise util.Abort(_("--rev and --remove are incompatible")) + raise error.Abort(_("--rev and --remove are incompatible")) if opts.get('rev'): rev_ = opts['rev'] message = opts.get('message') @@ -6339,12 +6340,12 @@ for n in names: if not repo.tagtype(n): - raise util.Abort(_("tag '%s' does not exist") % n) + raise error.Abort(_("tag '%s' does not exist") % n) if repo.tagtype(n) != expectedtype: if expectedtype == 'global': - raise util.Abort(_("tag '%s' is not a global tag") % n) + raise error.Abort(_("tag '%s' is not a global tag") % n) else: - raise util.Abort(_("tag '%s' is not a local tag") % n) + raise error.Abort(_("tag '%s' is not a local tag") % n) rev_ = 'null' if not message: # we don't translate commit messages @@ -6352,15 +6353,15 @@ elif not opts.get('force'): for n in names: if n in repo.tags(): - raise util.Abort(_("tag '%s' already exists " + raise error.Abort(_("tag '%s' already exists " "(use -f to force)") % n) if not opts.get('local'): p1, p2 = repo.dirstate.parents() if p2 != nullid: - raise util.Abort(_('uncommitted merge')) + raise error.Abort(_('uncommitted merge')) bheads = repo.branchheads() if not opts.get('force') and bheads and p1 not in bheads: - raise util.Abort(_('not at a branch head (use -f to force)')) + raise error.Abort(_('not at a branch head (use -f to force)')) r = scmutil.revsingle(repo, rev_).node() if not message: @@ -6381,7 +6382,7 @@ # don't allow tagging the null rev if (not opts.get('remove') and scmutil.revsingle(repo, rev_).rev() == nullrev): - raise util.Abort(_("cannot tag null revision")) + raise error.Abort(_("cannot tag null revision")) repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, editor=editor) @@ -6470,7 +6471,7 @@ op = bundle2.processbundle(repo, gen, lambda: tr) tr.close() except error.BundleUnknownFeatureError as exc: - raise util.Abort(_('%s: unknown bundle feature, %s') + raise error.Abort(_('%s: unknown bundle feature, %s') % (fname, exc), hint=_("see https://mercurial-scm.org/" "wiki/BundleFeature for more " @@ -6549,7 +6550,7 @@ Returns 0 on success, 1 if there are unresolved files. """ if rev and node: - raise util.Abort(_("please specify just one revision")) + raise error.Abort(_("please specify just one revision")) if rev is None or rev == '': rev = node @@ -6560,7 +6561,7 @@ if date: if rev is not None: - raise util.Abort(_("you can't specify a revision and a date")) + raise error.Abort(_("you can't specify a revision and a date")) rev = cmdutil.finddate(ui, repo, date) # with no argument, we also move the active bookmark, if any @@ -6571,7 +6572,8 @@ rev = scmutil.revsingle(repo, rev, rev).rev() if check and clean: - raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) + raise error.Abort(_("cannot specify both -c/--check and -C/--clean") + ) if check: cmdutil.bailifchanged(repo, merge=False)
--- a/mercurial/commandserver.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/commandserver.py Thu Oct 08 12:55:45 2015 -0700 @@ -8,7 +8,7 @@ from i18n import _ import struct import sys, os, errno, traceback, SocketServer -import dispatch, encoding, util +import dispatch, encoding, util, error logfile = None @@ -222,7 +222,7 @@ else: # clients are expected to check what commands are supported by # looking at the servers capabilities - raise util.Abort(_('unknown command %s') % cmd) + raise error.Abort(_('unknown command %s') % cmd) return cmd != '' @@ -301,7 +301,7 @@ sv.serve() # handle exceptions that may be raised by command server. most of # known exceptions are caught by dispatch. - except util.Abort as inst: + except error.Abort as inst: ui.warn(_('abort: %s\n') % inst) except IOError as inst: if inst.errno != errno.EPIPE: @@ -323,9 +323,9 @@ self.repo = repo self.address = opts['address'] if not util.safehasattr(SocketServer, 'UnixStreamServer'): - raise util.Abort(_('unsupported platform')) + raise error.Abort(_('unsupported platform')) if not self.address: - raise util.Abort(_('no socket path specified with --address')) + raise error.Abort(_('no socket path specified with --address')) def init(self): class cls(SocketServer.ForkingMixIn, SocketServer.UnixStreamServer): @@ -351,4 +351,4 @@ try: return _servicemap[mode](ui, repo, opts) except KeyError: - raise util.Abort(_('unknown mode %s') % mode) + raise error.Abort(_('unknown mode %s') % mode)
--- a/mercurial/context.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/context.py Thu Oct 08 12:55:45 2015 -0700 @@ -1060,7 +1060,7 @@ except error.CensoredNodeError: if self._repo.ui.config("censor", "policy", "abort") == "ignore": return "" - raise util.Abort(_("censored node: %s") % short(self._filenode), + raise error.Abort(_("censored node: %s") % short(self._filenode), hint=_("set censor.policy to ignore errors")) def size(self): @@ -1120,7 +1120,7 @@ try: branch = encoding.fromlocal(self._repo.dirstate.branch()) except UnicodeDecodeError: - raise util.Abort(_('branch name not in UTF-8!')) + raise error.Abort(_('branch name not in UTF-8!')) self._extra['branch'] = branch if self._extra['branch'] == '': self._extra['branch'] = 'default'
--- a/mercurial/crecord.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/crecord.py Thu Oct 08 12:55:45 2015 -0700 @@ -22,8 +22,8 @@ from .i18n import _ from . import ( encoding, + error, patch as patchmod, - util, ) # This is required for ncurses to display non-ASCII characters in default user @@ -47,7 +47,7 @@ curses except NameError: if os.name != 'nt': # Temporary hack to get running on Windows again - raise util.Abort( + raise error.Abort( _('the python curses/wcurses module is not available/installed')) _origstdout = sys.__stdout__ # used by gethw() @@ -498,7 +498,7 @@ f = signal.getsignal(signal.SIGTSTP) curses.wrapper(chunkselector.main) if chunkselector.initerr is not None: - raise util.Abort(chunkselector.initerr) + raise error.Abort(chunkselector.initerr) # ncurses does not restore signal handler for SIGTSTP signal.signal(signal.SIGTSTP, f) @@ -1566,7 +1566,7 @@ elif keypressed in ["H", "KEY_SLEFT"]: self.leftarrowshiftevent() elif keypressed in ["q"]: - raise util.Abort(_('user quit')) + raise error.Abort(_('user quit')) elif keypressed in ["c"]: if self.confirmcommit(): return True
--- a/mercurial/dagparser.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/dagparser.py Thu Oct 08 12:55:45 2015 -0700 @@ -11,7 +11,7 @@ import string from .i18n import _ -from . import util +from . import error def parsedag(desc): '''parses a DAG from a concise textual description; generates events @@ -269,7 +269,7 @@ s += c i += 1 c = nextch() - raise util.Abort(_('invalid character in dag description: ' + raise error.Abort(_('invalid character in dag description: ' '%s...') % s) def dagtextlines(events, @@ -298,13 +298,13 @@ # sanity check if r != wantr: - raise util.Abort(_("expected id %i, got %i") % (wantr, r)) + raise error.Abort(_("expected id %i, got %i") % (wantr, r)) if not ps: ps = [-1] else: for p in ps: if p >= r: - raise util.Abort(_("parent id %i is larger than " + raise error.Abort(_("parent id %i is larger than " "current id %i") % (p, r)) wantr += 1 @@ -366,7 +366,7 @@ yield '#' + data yield '\n' else: - raise util.Abort(_("invalid event type in dag: %s") + raise error.Abort(_("invalid event type in dag: %s") % str((type, data))) if run: yield '+' + str(run)
--- a/mercurial/destutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/destutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -8,7 +8,6 @@ from .i18n import _ from . import ( error, - util, obsolete, ) @@ -26,7 +25,7 @@ if wc.branch() == 'default': # no default branch! node = repo.lookup('tip') # update to tip else: - raise util.Abort(_("branch %s not found") % wc.branch()) + raise error.Abort(_("branch %s not found") % wc.branch()) if p1.obsolete() and not p1.children(): # allow updating to successors
--- a/mercurial/dirstate.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/dirstate.py Thu Oct 08 12:55:45 2015 -0700 @@ -7,7 +7,7 @@ from node import nullid from i18n import _ -import scmutil, util, osutil, parsers, encoding, pathutil +import scmutil, util, osutil, parsers, encoding, pathutil, error import os, stat, errno import match as matchmod @@ -134,7 +134,7 @@ if l == 40: return st[:20], st[20:40] elif l > 0 and l < 40: - raise util.Abort(_('working directory state appears damaged!')) + raise error.Abort(_('working directory state appears damaged!')) except IOError as err: if err.errno != errno.ENOENT: raise @@ -412,13 +412,13 @@ if state == 'a' or oldstate == 'r': scmutil.checkfilename(f) if f in self._dirs: - raise util.Abort(_('directory %r already in dirstate') % f) + raise error.Abort(_('directory %r already in dirstate') % f) # shadows for d in util.finddirs(f): if d in self._dirs: break if d in self._map and self[d] != 'r': - raise util.Abort( + raise error.Abort( _('file %r in dirstate clashes with %r') % (d, f)) if oldstate in "?r" and "_dirs" in self.__dict__: self._dirs.addpath(f) @@ -464,7 +464,7 @@ def otherparent(self, f): '''Mark as coming from the other parent, always dirty.''' if self._pl[1] == nullid: - raise util.Abort(_("setting %r to other parent " + raise error.Abort(_("setting %r to other parent " "only allowed in merges") % f) if f in self and self[f] == 'n': # merge-like
--- a/mercurial/discovery.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/discovery.py Thu Oct 08 12:55:45 2015 -0700 @@ -16,6 +16,7 @@ from . import ( bookmarks, branchmap, + error, obsolete, phases, setdiscovery, @@ -262,7 +263,7 @@ # 1. Check for new branches on the remote. if newbranches and not newbranch: # new branch requires --new-branch branchnames = ', '.join(sorted(newbranches)) - raise util.Abort(_("push creates new remote branches: %s!") + raise error.Abort(_("push creates new remote branches: %s!") % branchnames, hint=_("use 'hg push --new-branch' to create" " new remote branches")) @@ -390,4 +391,4 @@ for h in dhs: repo.ui.note((" %s\n") % short(h)) if errormsg: - raise util.Abort(errormsg, hint=hint) + raise error.Abort(errormsg, hint=hint)
--- 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)
--- a/mercurial/exchange.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/exchange.py Thu Oct 08 12:55:45 2015 -0700 @@ -30,7 +30,7 @@ magic, version = header[0:2], header[2:4] if magic != 'HG': - raise util.Abort(_('%s: not a Mercurial bundle') % fname) + raise error.Abort(_('%s: not a Mercurial bundle') % fname) if version == '10': if alg is None: alg = changegroup.readexactly(fh, 2) @@ -38,7 +38,7 @@ elif version.startswith('2'): return bundle2.getunbundler(ui, fh, magicstring=magic + version) else: - raise util.Abort(_('%s: unknown bundle version %s') % (fname, version)) + raise error.Abort(_('%s: unknown bundle version %s') % (fname, version)) def buildobsmarkerspart(bundler, markers): """add an obsmarker part to the bundler with <markers> @@ -193,7 +193,7 @@ msg = _("required features are not" " supported in the destination:" " %s") % (', '.join(sorted(missing))) - raise util.Abort(msg) + raise error.Abort(msg) # there are two ways to push to remote repo: # @@ -204,7 +204,7 @@ # servers, http servers). if not pushop.remote.canpush(): - raise util.Abort(_("destination does not support push")) + raise error.Abort(_("destination does not support push")) # get local lock as we might write phase data localwlock = locallock = None try: @@ -435,9 +435,9 @@ for node in outgoing.missingheads: ctx = unfi[node] if ctx.obsolete(): - raise util.Abort(mso % ctx) + raise error.Abort(mso % ctx) elif ctx.troubled(): - raise util.Abort(mst[ctx.troubles()[0]] % ctx) + raise error.Abort(mst[ctx.troubles()[0]] % ctx) # internal config: bookmarks.pushing newbm = pushop.ui.configlist('bookmarks', 'pushing') @@ -658,14 +658,14 @@ try: reply = pushop.remote.unbundle(stream, ['force'], 'push') except error.BundleValueError as exc: - raise util.Abort('missing support for %s' % exc) + raise error.Abort('missing support for %s' % exc) try: trgetter = None if pushback: trgetter = pushop.trmanager.transaction op = bundle2.processbundle(pushop.repo, reply, trgetter) except error.BundleValueError as exc: - raise util.Abort('missing support for %s' % exc) + raise error.Abort('missing support for %s' % exc) except error.PushkeyFailed as exc: partid = int(exc.partid) if partid not in pushop.pkfailcb: @@ -967,7 +967,7 @@ msg = _("required features are not" " supported in the destination:" " %s") % (', '.join(sorted(missing))) - raise util.Abort(msg) + raise error.Abort(msg) lock = pullop.repo.lock() try: @@ -1108,7 +1108,7 @@ try: op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) except error.BundleValueError as exc: - raise util.Abort('missing support for %s' % exc) + raise error.Abort('missing support for %s' % exc) if pullop.fetch: results = [cg['return'] for cg in op.records['changegroup']] @@ -1158,7 +1158,7 @@ elif pullop.heads is None: cg = pullop.remote.changegroup(pullop.fetch, 'pull') elif not pullop.remote.capable('changegroupsubset'): - raise util.Abort(_("partial pull cannot be done because " + raise error.Abort(_("partial pull cannot be done because " "other repository doesn't support " "changegroupsubset.")) else:
--- a/mercurial/fancyopts.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/fancyopts.py Thu Oct 08 12:55:45 2015 -0700 @@ -10,7 +10,7 @@ import getopt from .i18n import _ -from . import util +from . import error def gnugetopt(args, options, longoptions): """Parse options mostly like getopt.gnu_getopt. @@ -114,7 +114,7 @@ try: state[name] = int(val) except ValueError: - raise util.Abort(_('invalid value %r for option %s, ' + raise error.Abort(_('invalid value %r for option %s, ' 'expected int') % (val, opt)) elif t is type(''): state[name] = val
--- a/mercurial/fileset.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/fileset.py Thu Oct 08 12:55:45 2015 -0700 @@ -363,7 +363,7 @@ try: d.decode(enc) except LookupError: - raise util.Abort(_("unknown encoding '%s'") % enc) + raise error.Abort(_("unknown encoding '%s'") % enc) except UnicodeDecodeError: continue s.append(f)
--- a/mercurial/formatter.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/formatter.py Thu Oct 08 12:55:45 2015 -0700 @@ -18,8 +18,8 @@ from . import ( encoding, + error, templater, - util, ) class baseformatter(object): @@ -179,7 +179,7 @@ if tmpl == 'list': ui.write(_("available styles: %s\n") % templater.stylelist()) - raise util.Abort(_("specify a template")) + raise error.Abort(_("specify a template")) # perhaps it's a path to a map or a template if ('/' in tmpl or '\\' in tmpl) and os.path.isfile(tmpl):
--- a/mercurial/hbisect.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/hbisect.py Thu Oct 08 12:55:45 2015 -0700 @@ -20,7 +20,6 @@ ) from . import ( error, - util, ) def bisect(changelog, state): @@ -74,8 +73,8 @@ if not ancestors: # now we're confused if (len(state['bad']) == 1 and len(state['good']) == 1 and state['bad'] != state['good']): - raise util.Abort(_("starting revisions are not directly related")) - raise util.Abort(_("inconsistent state, %s:%s is good and bad") + raise error.Abort(_("starting revisions are not directly related")) + raise error.Abort(_("inconsistent state, %s:%s is good and bad") % (badrev, short(bad))) # build children dict @@ -149,7 +148,7 @@ kind, node = l[:-1].split() node = repo.lookup(node) if kind not in state: - raise util.Abort(_("unknown bisect kind %s") % kind) + raise error.Abort(_("unknown bisect kind %s") % kind) state[kind].append(node) return state
--- a/mercurial/help.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/help.py Thu Oct 08 12:55:45 2015 -0700 @@ -502,7 +502,7 @@ if not rst: msg = _('no matches') hint = _('try "hg help" for a list of topics') - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) elif name and name != 'shortlist': queries = [] if unknowncmd: @@ -525,7 +525,7 @@ else: msg = _('no such help topic: %s') % name hint = _('try "hg help --keyword %s"') % name - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) else: # program name if not ui.quiet:
--- a/mercurial/hg.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/hg.py Thu Oct 08 12:55:45 2015 -0700 @@ -65,7 +65,7 @@ if not peer.capable('branchmap'): if branches: - raise util.Abort(_("remote branch lookup not supported")) + raise error.Abort(_("remote branch lookup not supported")) revs.append(hashbranch) return revs, revs[0] branchmap = peer.branchmap() @@ -73,7 +73,7 @@ def primary(branch): if branch == '.': if not lrepo: - raise util.Abort(_("dirstate branch not accessible")) + raise error.Abort(_("dirstate branch not accessible")) branch = lrepo.dirstate.branch() if branch in branchmap: revs.extend(node.hex(r) for r in reversed(branchmap[branch])) @@ -160,7 +160,7 @@ peer = _peerorrepo(ui, path, create) repo = peer.local() if not repo: - raise util.Abort(_("repository '%s' is not local") % + raise error.Abort(_("repository '%s' is not local") % (path or peer.url())) return repo.filtered('visible') @@ -194,7 +194,7 @@ '''create a shared repository''' if not islocal(source): - raise util.Abort(_('can only share local repositories')) + raise error.Abort(_('can only share local repositories')) if not dest: dest = defaultdest(source) @@ -217,7 +217,7 @@ destvfs = scmutil.vfs(os.path.join(destwvfs.base, '.hg'), realpath=True) if destvfs.lexists(): - raise util.Abort(_('destination already exists')) + raise error.Abort(_('destination already exists')) if not destwvfs.isdir(): destwvfs.mkdir() @@ -320,7 +320,7 @@ revs = None if rev: if not srcpeer.capable('lookup'): - raise util.Abort(_("src repository does not support " + raise error.Abort(_("src repository does not support " "revision lookup and so doesn't " "support clone by revision")) revs = [srcpeer.lookup(r) for r in rev] @@ -416,14 +416,14 @@ source = util.urllocalpath(source) if not dest: - raise util.Abort(_("empty destination path is not valid")) + raise error.Abort(_("empty destination path is not valid")) destvfs = scmutil.vfs(dest, expandpath=True) if destvfs.lexists(): if not destvfs.isdir(): - raise util.Abort(_("destination '%s' already exists") % dest) + raise error.Abort(_("destination '%s' already exists") % dest) elif destvfs.listdir(): - raise util.Abort(_("destination '%s' is not empty") % dest) + raise error.Abort(_("destination '%s' is not empty") % dest) shareopts = shareopts or {} sharepool = shareopts.get('pool') @@ -448,7 +448,7 @@ elif sharenamemode == 'remote': sharepath = os.path.join(sharepool, util.sha1(source).hexdigest()) else: - raise util.Abort('unknown share naming mode: %s' % sharenamemode) + raise error.Abort('unknown share naming mode: %s' % sharenamemode) if sharepath: return clonewithshare(ui, peeropts, sharepath, source, srcpeer, @@ -494,7 +494,7 @@ except OSError as inst: if inst.errno == errno.EEXIST: cleandir = None - raise util.Abort(_("destination '%s' already exists") + raise error.Abort(_("destination '%s' already exists") % dest) raise @@ -534,14 +534,14 @@ except OSError as inst: if inst.errno == errno.EEXIST: cleandir = None - raise util.Abort(_("destination '%s' already exists") + raise error.Abort(_("destination '%s' already exists") % dest) raise revs = None if rev: if not srcpeer.capable('lookup'): - raise util.Abort(_("src repository does not support " + raise error.Abort(_("src repository does not support " "revision lookup and so doesn't " "support clone by revision")) revs = [srcpeer.lookup(r) for r in rev] @@ -557,7 +557,8 @@ exchange.push(srcrepo, destpeer, revs=revs, bookmarks=srcrepo._bookmarks.keys()) else: - raise util.Abort(_("clone from remote to remote not supported")) + raise error.Abort(_("clone from remote to remote not supported") + ) cleandir = None
--- a/mercurial/hgweb/hgwebdir_mod.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Thu Oct 08 12:55:45 2015 -0700 @@ -118,7 +118,7 @@ if not isinstance(self.conf, (dict, list, tuple)): map = {'paths': 'hgweb-paths'} if not os.path.exists(self.conf): - raise util.Abort(_('config file %s not found!') % self.conf) + raise error.Abort(_('config file %s not found!') % self.conf) u.readconfig(self.conf, remap=map, trust=True) paths = [] for name, ignored in u.configitems('hgweb-paths'):
--- a/mercurial/hgweb/server.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/hgweb/server.py Thu Oct 08 12:55:45 2015 -0700 @@ -208,7 +208,7 @@ import OpenSSL OpenSSL.SSL.Context except ImportError: - raise util.Abort(_("SSL support is unavailable")) + raise error.Abort(_("SSL support is unavailable")) ctx = OpenSSL.SSL.Context(OpenSSL.SSL.TLSv1_METHOD) ctx.use_privatekey_file(ssl_cert) ctx.use_certificate_file(ssl_cert) @@ -249,7 +249,7 @@ import ssl ssl.wrap_socket except ImportError: - raise util.Abort(_("SSL support is unavailable")) + raise error.Abort(_("SSL support is unavailable")) httpserver.socket = ssl.wrap_socket( httpserver.socket, server_side=True, certfile=ssl_cert, ssl_version=ssl.PROTOCOL_TLSv1) @@ -345,5 +345,5 @@ try: return cls(ui, app, (address, port), handler) except socket.error as inst: - raise util.Abort(_("cannot start server at '%s:%d': %s") + raise error.Abort(_("cannot start server at '%s:%d': %s") % (address, port, inst.args[1]))
--- 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:
--- 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)
--- a/mercurial/localrepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/localrepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -640,7 +640,7 @@ if not local: m = matchmod.exact(self.root, '', ['.hgtags']) if any(self.status(match=m, unknown=True, ignored=True)): - raise util.Abort(_('working copy of .hgtags is changed'), + raise error.Abort(_('working copy of .hgtags is changed'), hint=_('please commit .hgtags manually')) self.tags() # instantiate the cache @@ -1119,7 +1119,7 @@ desc = None if not force and self['.'] != self['tip'] and desc == 'commit': - raise util.Abort( + raise error.Abort( _('rollback of last commit while not checked out ' 'may lose data'), hint=_('use -f to force')) @@ -1433,7 +1433,7 @@ extra = {} def fail(f, msg): - raise util.Abort('%s: %s' % (f, msg)) + raise error.Abort('%s: %s' % (f, msg)) if not match: match = matchmod.always(self.root, '') @@ -1449,7 +1449,7 @@ merge = len(wctx.parents()) > 1 if not force and merge and match.ispartial(): - raise util.Abort(_('cannot partially commit a merge ' + raise error.Abort(_('cannot partially commit a merge ' '(do not specify files or patterns)')) status = self.status(match=match, clean=force) @@ -1477,12 +1477,12 @@ newstate[s] = oldstate[s] continue if not force: - raise util.Abort( + raise error.Abort( _("commit with new subrepo %s excluded") % s) dirtyreason = wctx.sub(s).dirtyreason(True) if dirtyreason: if not self.ui.configbool('ui', 'commitsubrepos'): - raise util.Abort(dirtyreason, + raise error.Abort(dirtyreason, hint=_("use --subrepos for recursive commit")) subs.append(s) commitsubs.add(s) @@ -1499,7 +1499,7 @@ if subs: if (not match('.hgsub') and '.hgsub' in (wctx.modified() + wctx.added())): - raise util.Abort( + raise error.Abort( _("can't commit subrepos without .hgsub")) status.modified.insert(0, '.hgsubstate') @@ -1541,12 +1541,12 @@ return None if merge and cctx.deleted(): - raise util.Abort(_("cannot commit merge with missing files")) + raise error.Abort(_("cannot commit merge with missing files")) ms = mergemod.mergestate(self) for f in status.modified: if f in ms and ms[f] == 'u': - raise util.Abort(_('unresolved merge conflicts ' + raise error.Abort(_('unresolved merge conflicts ' '(see "hg help resolve")')) if editor:
--- a/mercurial/mail.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/mail.py Thu Oct 08 12:55:45 2015 -0700 @@ -18,6 +18,7 @@ from .i18n import _ from . import ( encoding, + error, sslutil, util, ) @@ -93,7 +94,7 @@ return new_socket else: def SMTPS(sslkwargs, keyfile=None, certfile=None, **kwargs): - raise util.Abort(_('SMTPS requires Python 2.6 or later')) + raise error.Abort(_('SMTPS requires Python 2.6 or later')) def _smtp(ui): '''build an smtp connection and return a function to send mail''' @@ -103,14 +104,14 @@ starttls = tls == 'starttls' or util.parsebool(tls) smtps = tls == 'smtps' if (starttls or smtps) and not util.safehasattr(socket, 'ssl'): - raise util.Abort(_("can't use TLS: Python SSL support not installed")) + raise error.Abort(_("can't use TLS: Python SSL support not installed")) mailhost = ui.config('smtp', 'host') if not mailhost: - raise util.Abort(_('smtp.host not configured - cannot send mail')) + raise error.Abort(_('smtp.host not configured - cannot send mail')) verifycert = ui.config('smtp', 'verifycert', 'strict') if verifycert not in ['strict', 'loose']: if util.parsebool(verifycert) is not False: - raise util.Abort(_('invalid smtp.verifycert configuration: %s') + raise error.Abort(_('invalid smtp.verifycert configuration: %s') % (verifycert)) verifycert = False if (starttls or smtps) and verifycert: @@ -151,16 +152,16 @@ try: s.login(username, password) except smtplib.SMTPException as inst: - raise util.Abort(inst) + raise error.Abort(inst) def send(sender, recipients, msg): try: return s.sendmail(sender, recipients, msg) except smtplib.SMTPRecipientsRefused as inst: recipients = [r[1] for r in inst.recipients.values()] - raise util.Abort('\n' + '\n'.join(recipients)) + raise error.Abort('\n' + '\n'.join(recipients)) except smtplib.SMTPException as inst: - raise util.Abort(inst) + raise error.Abort(inst) return send @@ -174,7 +175,7 @@ fp.write(msg) ret = fp.close() if ret: - raise util.Abort('%s %s' % ( + raise error.Abort('%s %s' % ( os.path.basename(program.split(None, 1)[0]), util.explainexit(ret)[0])) @@ -208,11 +209,11 @@ method = ui.config('email', 'method', 'smtp') if method == 'smtp': if not ui.config('smtp', 'host'): - raise util.Abort(_('smtp specified as email transport, ' + raise error.Abort(_('smtp specified as email transport, ' 'but no smtp host configured')) else: if not util.findexe(method): - raise util.Abort(_('%r specified as email transport, ' + raise error.Abort(_('%r specified as email transport, ' 'but not in PATH') % method) def mimetextpatch(s, subtype='plain', display=False): @@ -302,13 +303,13 @@ dom = dom.decode(encoding.encoding).encode('idna') addr = '%s@%s' % (acc, dom) except UnicodeDecodeError: - raise util.Abort(_('invalid email address: %s') % addr) + raise error.Abort(_('invalid email address: %s') % addr) except ValueError: try: # too strict? addr = addr.encode('ascii') except UnicodeDecodeError: - raise util.Abort(_('invalid local address: %s') % addr) + raise error.Abort(_('invalid local address: %s') % addr) return email.Utils.formataddr((name, addr)) def addressencode(ui, address, charsets=None, display=False):
--- a/mercurial/match.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/match.py Thu Oct 08 12:55:45 2015 -0700 @@ -13,6 +13,7 @@ from .i18n import _ from . import ( + error, pathutil, util, ) @@ -37,7 +38,7 @@ for kind, pat, source in kindpats: if kind == 'set': if not ctx: - raise util.Abort("fileset expression with no context") + raise error.Abort("fileset expression with no context") s = ctx.getfileset(pat) fset.update(s) @@ -290,7 +291,7 @@ files = files.splitlines() files = [f for f in files if f] except EnvironmentError: - raise util.Abort(_("unable to read file list (%s)") % pat) + raise error.Abort(_("unable to read file list (%s)") % pat) for k, p, source in self._normalize(files, default, root, cwd, auditor): kindpats.append((k, p, pat)) @@ -302,8 +303,8 @@ for k, p, source in self._normalize(includepats, default, root, cwd, auditor): kindpats.append((k, p, source or pat)) - except util.Abort as inst: - raise util.Abort('%s: %s' % (pat, inst[0])) + except error.Abort as inst: + raise error.Abort('%s: %s' % (pat, inst[0])) except IOError as inst: if self._warn: self._warn(_("skipping unreadable pattern file " @@ -587,11 +588,11 @@ _rematcher('(?:%s)' % _regex(k, p, globsuffix)) except re.error: if s: - raise util.Abort(_("%s: invalid pattern (%s): %s") % + raise error.Abort(_("%s: invalid pattern (%s): %s") % (s, k, p)) else: - raise util.Abort(_("invalid pattern (%s): %s") % (k, p)) - raise util.Abort(_("invalid pattern")) + raise error.Abort(_("invalid pattern (%s): %s") % (k, p)) + raise error.Abort(_("invalid pattern")) def _roots(kindpats): '''return roots and exact explicitly listed files from patterns
--- a/mercurial/mdiff.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/mdiff.py Thu Oct 08 12:55:45 2015 -0700 @@ -6,7 +6,7 @@ # GNU General Public License version 2 or any later version. from i18n import _ -import bdiff, mpatch, util, base85 +import bdiff, mpatch, util, base85, error import re, struct, zlib def splitnewlines(text): @@ -59,7 +59,7 @@ try: self.context = int(self.context) except ValueError: - raise util.Abort(_('diff context lines count must be ' + raise error.Abort(_('diff context lines count must be ' 'an integer, not %r') % self.context) def copy(self, **kwargs):
--- a/mercurial/merge.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/merge.py Thu Oct 08 12:55:45 2015 -0700 @@ -22,6 +22,7 @@ from . import ( copies, destutil, + error, filemerge, obsolete, subrepo, @@ -98,7 +99,7 @@ bits = record.split('\0') self._state[bits[0]] = bits[1:] elif not rtype.islower(): - raise util.Abort(_('unsupported merge state record: %s') + raise error.Abort(_('unsupported merge state record: %s') % rtype) self._dirty = False @@ -346,7 +347,7 @@ for f in sorted(aborts): repo.ui.warn(_("%s: untracked file differs\n") % f) if aborts: - raise util.Abort(_("untracked files in working directory differ " + raise error.Abort(_("untracked files in working directory differ " "from files in requested revision")) for f, (m, args, msg) in actions.iteritems(): @@ -419,7 +420,7 @@ for f in sorted(pmmf): fold = util.normcase(f) if fold in foldmap: - raise util.Abort(_("case-folding collision between %s and %s") + raise error.Abort(_("case-folding collision between %s and %s") % (f, foldmap[fold])) foldmap[fold] = f @@ -1011,18 +1012,18 @@ ### check phase if not overwrite and len(pl) > 1: - raise util.Abort(_("outstanding uncommitted merge")) + raise error.Abort(_("outstanding uncommitted merge")) if branchmerge: if pas == [p2]: - raise util.Abort(_("merging with a working directory ancestor" + raise error.Abort(_("merging with a working directory ancestor" " has no effect")) elif pas == [p1]: if not mergeancestor and p1.branch() == p2.branch(): - raise util.Abort(_("nothing to merge"), + raise error.Abort(_("nothing to merge"), hint=_("use 'hg update' " "or check 'hg heads'")) if not force and (wc.files() or wc.deleted()): - raise util.Abort(_("uncommitted changes"), + raise error.Abort(_("uncommitted changes"), hint=_("use 'hg status' to list changes")) for s in sorted(wc.substate): wc.sub(s).bailifchanged() @@ -1051,11 +1052,11 @@ else: hint = _("commit or update --clean to discard" " changes") - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) else: # node is none msg = _("not a linear update") hint = _("merge or update --check to force update") - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) else: # Allow jumping branches if clean and specific rev given pas = [p1]
--- a/mercurial/obsolete.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/obsolete.py Thu Oct 08 12:55:45 2015 -0700 @@ -68,7 +68,7 @@ """ import errno, struct -import util, base85, node, parsers +import util, base85, node, parsers, error import phases from i18n import _ @@ -164,7 +164,7 @@ # (metadata will be decoded on demand) metadata = data[off:off + mdsize] if len(metadata) != mdsize: - raise util.Abort(_('parsing obsolete marker: metadata is too ' + raise error.Abort(_('parsing obsolete marker: metadata is too ' 'short, %d bytes expected, got %d') % (mdsize, len(metadata))) off += mdsize @@ -200,7 +200,7 @@ def _fm0encodeonemarker(marker): pre, sucs, flags, metadata, date, parents = marker if flags & usingsha256: - raise util.Abort(_('cannot handle sha256 with old obsstore format')) + raise error.Abort(_('cannot handle sha256 with old obsstore format')) metadata = dict(metadata) time, tz = date metadata['date'] = '%r %i' % (time, tz) @@ -414,7 +414,7 @@ diskversion = _unpack('>B', data[off:off + 1])[0] off += 1 if diskversion not in formats: - raise util.Abort(_('parsing obsolete marker: unknown version %r') + raise error.Abort(_('parsing obsolete marker: unknown version %r') % diskversion) return diskversion, formats[diskversion][0](data, off) @@ -496,7 +496,7 @@ """ for mark in markers: if node.nullid in mark[1]: - raise util.Abort(_('bad obsolescence marker detected: ' + raise error.Abort(_('bad obsolescence marker detected: ' 'invalid successors nullid')) class obsstore(object): @@ -583,8 +583,8 @@ Take care of filtering duplicate. Return the number of new marker.""" if self._readonly: - raise util.Abort('creating obsolete markers is not enabled on this ' - 'repo') + raise error.Abort('creating obsolete markers is not enabled on ' + 'this repo') known = set(self._all) new = [] for m in markers: @@ -1217,7 +1217,7 @@ localmetadata.update(rel[2]) if not prec.mutable(): - raise util.Abort("cannot obsolete public changeset: %s" + raise error.Abort("cannot obsolete public changeset: %s" % prec, hint='see "hg help phases" for details') nprec = prec.node() @@ -1226,7 +1226,7 @@ if not nsucs: npare = tuple(p.node() for p in prec.parents()) if nprec in nsucs: - raise util.Abort("changeset %s cannot obsolete itself" % prec) + raise error.Abort("changeset %s cannot obsolete itself" % prec) repo.obsstore.create(tr, nprec, nsucs, flag, parents=npare, date=date, metadata=localmetadata) repo.filteredrevcache.clear() @@ -1250,7 +1250,7 @@ # createmarkers must be enabled if other options are enabled if ((allowunstableopt in result or exchangeopt in result) and not createmarkersopt in result): - raise util.Abort(_("'createmarkers' obsolete option must be enabled " + raise error.Abort(_("'createmarkers' obsolete option must be enabled " "if other obsolete options are enabled")) return option in result
--- a/mercurial/patch.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/patch.py Thu Oct 08 12:55:45 2015 -0700 @@ -1056,7 +1056,7 @@ elif r == 6: # all ret = skipall = True elif r == 7: # quit - raise util.Abort(_('user quit')) + raise error.Abort(_('user quit')) return ret, skipfile, skipall, newpatches seen = set() @@ -1964,7 +1964,7 @@ else: store.setfile(path, data, mode) else: - raise util.Abort(_('unsupported parser state: %s') % state) + raise error.Abort(_('unsupported parser state: %s') % state) if current_file: rejects += current_file.close() @@ -2022,7 +2022,7 @@ if eolmode is None: eolmode = ui.config('patch', 'eol', 'strict') if eolmode.lower() not in eolmodes: - raise util.Abort(_('unsupported line endings type: %s') % eolmode) + raise error.Abort(_('unsupported line endings type: %s') % eolmode) eolmode = eolmode.lower() store = filestore() @@ -2095,7 +2095,7 @@ if gp.op == 'RENAME': changed.add(gp.oldpath) elif state not in ('hunk', 'git'): - raise util.Abort(_('unsupported parser state: %s') % state) + raise error.Abort(_('unsupported parser state: %s') % state) return changed finally: fp.close()
--- a/mercurial/pathutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/pathutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -8,6 +8,7 @@ from .i18n import _ from . import ( encoding, + error, util, ) @@ -47,18 +48,18 @@ return # AIX ignores "/" at end of path, others raise EISDIR. if util.endswithsep(path): - raise util.Abort(_("path ends in directory separator: %s") % path) + raise error.Abort(_("path ends in directory separator: %s") % path) parts = util.splitpath(path) if (os.path.splitdrive(path)[0] or _lowerclean(parts[0]) in ('.hg', '.hg.', '') or os.pardir in parts): - raise util.Abort(_("path contains illegal component: %s") % path) + raise error.Abort(_("path contains illegal component: %s") % path) # Windows shortname aliases for p in parts: if "~" in p: first, last = p.split("~", 1) if last.isdigit() and first.upper() in ["HG", "HG8B6C"]: - raise util.Abort(_("path contains illegal component: %s") + raise error.Abort(_("path contains illegal component: %s") % path) if '.hg' in _lowerclean(path): lparts = [_lowerclean(p.lower()) for p in parts] @@ -66,7 +67,7 @@ if p in lparts[1:]: pos = lparts.index(p) base = os.path.join(*parts[:pos]) - raise util.Abort(_("path '%s' is inside nested repo %r") + raise error.Abort(_("path '%s' is inside nested repo %r") % (path, base)) normparts = util.splitpath(normpath) @@ -90,13 +91,13 @@ raise else: if stat.S_ISLNK(st.st_mode): - raise util.Abort( + raise error.Abort( _('path %r traverses symbolic link %r') % (path, prefix)) elif (stat.S_ISDIR(st.st_mode) and os.path.isdir(os.path.join(curpath, '.hg'))): if not self.callback or not self.callback(curpath): - raise util.Abort(_("path '%s' is inside nested " + raise error.Abort(_("path '%s' is inside nested " "repo %r") % (path, prefix)) prefixes.append(normprefix) @@ -112,7 +113,7 @@ try: self(path) return True - except (OSError, util.Abort): + except (OSError, error.Abort): return False def canonpath(root, cwd, myname, auditor=None): @@ -167,10 +168,10 @@ canonpath(root, root, myname, auditor) hint = (_("consider using '--cwd %s'") % os.path.relpath(root, cwd)) - except util.Abort: + except error.Abort: pass - raise util.Abort(_("%s not under root '%s'") % (myname, root), + raise error.Abort(_("%s not under root '%s'") % (myname, root), hint=hint) def normasprefix(path):
--- a/mercurial/phases.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/phases.py Thu Oct 08 12:55:45 2015 -0700 @@ -115,7 +115,6 @@ ) from . import ( error, - util, ) allphases = public, draft, secret = range(3) @@ -306,7 +305,7 @@ if self.phase(repo, repo[n].rev()) < targetphase] if newroots: if nullid in newroots: - raise util.Abort(_('cannot change null revision phase')) + raise error.Abort(_('cannot change null revision phase')) currentroots = currentroots.copy() currentroots.update(newroots) ctxs = repo.set('roots(%ln::)', currentroots)
--- a/mercurial/repair.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/repair.py Thu Oct 08 12:55:45 2015 -0700 @@ -15,6 +15,7 @@ from . import ( bundle2, changegroup, + error, exchange, util, ) @@ -156,7 +157,7 @@ if curtr is not None: del curtr # avoid carrying reference to transaction for nothing msg = _('programming error: cannot strip from inside a transaction') - raise util.Abort(msg, hint=_('contact your extension maintainer')) + raise error.Abort(msg, hint=_('contact your extension maintainer')) tr = repo.transaction("strip") offset = len(tr.entries)
--- a/mercurial/revset.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/revset.py Thu Oct 08 12:55:45 2015 -0700 @@ -480,11 +480,11 @@ else: node = bmheads[0] elif len(bmheads) > 2: - raise util.Abort(_("multiple matching bookmarks to merge - " + raise error.Abort(_("multiple matching bookmarks to merge - " "please merge with an explicit rev or bookmark"), hint=_("run 'hg heads' to see all heads")) elif len(bmheads) <= 1: - raise util.Abort(_("no matching bookmark to merge - " + raise error.Abort(_("no matching bookmark to merge - " "please merge with an explicit rev or bookmark"), hint=_("run 'hg heads' to see all heads")) else: @@ -493,7 +493,7 @@ nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] if len(nbhs) > 2: - raise util.Abort(_("branch '%s' has %d heads - " + raise error.Abort(_("branch '%s' has %d heads - " "please merge with an explicit rev") % (branch, len(bheads)), hint=_("run 'hg heads .' to see heads")) @@ -501,21 +501,21 @@ parent = repo.dirstate.p1() if len(nbhs) <= 1: if len(bheads) > 1: - raise util.Abort(_("heads are bookmarked - " + raise error.Abort(_("heads are bookmarked - " "please merge with an explicit rev"), hint=_("run 'hg heads' to see all heads")) if len(repo.heads()) > 1: - raise util.Abort(_("branch '%s' has one head - " + raise error.Abort(_("branch '%s' has one head - " "please merge with an explicit rev") % branch, hint=_("run 'hg heads' to see all heads")) msg, hint = _('nothing to merge'), None if parent != repo.lookup(branch): hint = _("use 'hg update' instead") - raise util.Abort(msg, hint=hint) + raise error.Abort(msg, hint=hint) if parent not in bheads: - raise util.Abort(_('working directory not at a head revision'), + raise error.Abort(_('working directory not at a head revision'), hint=_("use 'hg update' or merge with an " "explicit revision")) if parent == nbhs[0]: @@ -721,7 +721,7 @@ try: bundlerevs = repo.changelog.bundlerevs except AttributeError: - raise util.Abort(_("no bundle provided - specify with -R")) + raise error.Abort(_("no bundle provided - specify with -R")) return subset & bundlerevs def checkstatus(repo, subset, pat, field): @@ -2669,7 +2669,7 @@ alias = _getalias(aliases, tree) if alias is not None: if alias.error: - raise util.Abort(alias.error) + raise error.Abort(alias.error) if alias in expanding: raise error.ParseError(_('infinite expansion of revset alias "%s" ' 'detected') % alias.name) @@ -2868,7 +2868,7 @@ ret += listexp(list(args[arg]), d) arg += 1 else: - raise util.Abort('unexpected revspec format character %s' % d) + raise error.Abort('unexpected revspec format character %s' % d) else: ret += c pos += 1
--- a/mercurial/scmutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/scmutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -123,20 +123,20 @@ # Do not use the "kind" parameter in ui output. # It makes strings difficult to translate. if lbl in ['tip', '.', 'null']: - raise util.Abort(_("the name '%s' is reserved") % lbl) + raise error.Abort(_("the name '%s' is reserved") % lbl) for c in (':', '\0', '\n', '\r'): if c in lbl: - raise util.Abort(_("%r cannot be used in a name") % c) + raise error.Abort(_("%r cannot be used in a name") % c) try: int(lbl) - raise util.Abort(_("cannot use an integer as a name")) + raise error.Abort(_("cannot use an integer as a name")) except ValueError: pass def checkfilename(f): '''Check that the filename f is an acceptable filename for a tracked file''' if '\r' in f or '\n' in f: - raise util.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) + raise error.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f) def checkportable(ui, f): '''Check if filename f is portable and warn or abort depending on config''' @@ -147,7 +147,7 @@ if msg: msg = "%s: %r" % (msg, f) if abort: - raise util.Abort(msg) + raise error.Abort(msg) ui.warn(_("warning: %s\n") % msg) def checkportabilityalert(ui): @@ -182,7 +182,7 @@ if fl in self._loweredfiles and f not in self._dirstate: msg = _('possible case-folding collision for %s') % f if self._abort: - raise util.Abort(msg) + raise error.Abort(msg) self._ui.warn(_("warning: %s\n") % msg) self._loweredfiles.add(fl) self._newfiles.add(f) @@ -475,7 +475,7 @@ if self._audit: r = util.checkosfilename(path) if r: - raise util.Abort("%s: %r" % (r, path)) + raise error.Abort("%s: %r" % (r, path)) self.audit(path) f = self.join(path) @@ -583,7 +583,7 @@ def __call__(self, path, mode='r', *args, **kw): if mode not in ('r', 'rb'): - raise util.Abort('this vfs is read only') + raise error.Abort('this vfs is read only') return self.vfs(path, mode, *args, **kw) def join(self, path, *insidef): @@ -689,7 +689,7 @@ l = revrange(repo, [revspec]) if not l: - raise util.Abort(_('empty revision set')) + raise error.Abort(_('empty revision set')) return repo[l.last()] def _pairspec(revspec): @@ -716,7 +716,7 @@ second = l.last() if first is None: - raise util.Abort(_('empty revision range')) + raise error.Abort(_('empty revision range')) # if top-level is range expression, the result must always be a pair if first == second and len(revs) == 1 and not _pairspec(revs[0]):
--- a/mercurial/setdiscovery.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/setdiscovery.py Thu Oct 08 12:55:45 2015 -0700 @@ -52,7 +52,7 @@ ) from . import ( dagutil, - util, + error, ) def _updatesample(dag, nodes, sample, quicksamplesize=0): @@ -241,7 +241,7 @@ if not result and srvheadhashes != [nullid]: if abortwhenunrelated: - raise util.Abort(_("repository is unrelated")) + raise error.Abort(_("repository is unrelated")) else: ui.warn(_("warning: repository is unrelated\n")) return (set([nullid]), True, srvheadhashes,)
--- a/mercurial/simplemerge.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/simplemerge.py Thu Oct 08 12:55:45 2015 -0700 @@ -23,6 +23,7 @@ from .i18n import _ from . import ( + error, mdiff, scmutil, util, @@ -361,7 +362,7 @@ if not opts.get('quiet'): ui.warn(_('warning: %s\n') % msg) if not opts.get('text'): - raise util.Abort(msg) + raise error.Abort(msg) return text mode = opts.get('mode','merge') @@ -381,13 +382,13 @@ if len(labels) > 2: name_base = labels[2] if len(labels) > 3: - raise util.Abort(_("can only specify three labels.")) + raise error.Abort(_("can only specify three labels.")) try: localtext = readfile(local) basetext = readfile(base) othertext = readfile(other) - except util.Abort: + except error.Abort: return 1 local = os.path.realpath(local)
--- a/mercurial/sshpeer.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/sshpeer.py Thu Oct 08 12:55:45 2015 -0700 @@ -277,7 +277,7 @@ r = self._call(cmd, **args) if r: # XXX needs to be made better - raise util.Abort('unexpected remote reply: %s' % r) + raise error.Abort('unexpected remote reply: %s' % r) while True: d = fp.read(4096) if not d:
--- a/mercurial/sshserver.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/sshserver.py Thu Oct 08 12:55:45 2015 -0700 @@ -12,6 +12,7 @@ import sys from . import ( + error, hook, util, wireproto, @@ -39,7 +40,7 @@ argline = self.fin.readline()[:-1] arg, l = argline.split() if arg not in keys: - raise util.Abort("unexpected parameter %r" % arg) + raise error.Abort("unexpected parameter %r" % arg) if arg == '*': star = {} for k in xrange(int(l)):
--- a/mercurial/sslutil.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/sslutil.py Thu Oct 08 12:55:45 2015 -0700 @@ -14,7 +14,7 @@ import sys from .i18n import _ -from . import util +from . import error, util _canloaddefaultcerts = False try: @@ -50,7 +50,7 @@ # closed # - see http://bugs.python.org/issue13721 if not sslsocket.cipher(): - raise util.Abort(_('ssl connection failed')) + raise error.Abort(_('ssl connection failed')) return sslsocket except AttributeError: def wrapsocket(sock, keyfile, certfile, ui, cert_reqs=ssl.CERT_NONE, @@ -62,7 +62,7 @@ # closed # - see http://bugs.python.org/issue13721 if not sslsocket.cipher(): - raise util.Abort(_('ssl connection failed')) + raise error.Abort(_('ssl connection failed')) return sslsocket def _verifycert(cert, hostname): @@ -140,7 +140,7 @@ elif cacerts: cacerts = util.expandpath(cacerts) if not os.path.exists(cacerts): - raise util.Abort(_('could not find web.cacerts: %s') % cacerts) + raise error.Abort(_('could not find web.cacerts: %s') % cacerts) else: cacerts = _defaultcacerts() if cacerts and cacerts != '!': @@ -163,15 +163,15 @@ hostfingerprint = self.ui.config('hostfingerprints', host) if not sock.cipher(): # work around http://bugs.python.org/issue13721 - raise util.Abort(_('%s ssl connection error') % host) + raise error.Abort(_('%s ssl connection error') % host) try: peercert = sock.getpeercert(True) peercert2 = sock.getpeercert() except AttributeError: - raise util.Abort(_('%s ssl connection error') % host) + raise error.Abort(_('%s ssl connection error') % host) if not peercert: - raise util.Abort(_('%s certificate error: ' + raise error.Abort(_('%s certificate error: ' 'no certificate received') % host) peerfingerprint = util.sha1(peercert).hexdigest() nicefingerprint = ":".join([peerfingerprint[x:x + 2] @@ -179,7 +179,7 @@ if hostfingerprint: if peerfingerprint.lower() != \ hostfingerprint.replace(':', '').lower(): - raise util.Abort(_('certificate for %s has unexpected ' + raise error.Abort(_('certificate for %s has unexpected ' 'fingerprint %s') % (host, nicefingerprint), hint=_('check hostfingerprint configuration')) self.ui.debug('%s certificate matched fingerprint %s\n' % @@ -187,13 +187,13 @@ elif cacerts != '!': msg = _verifycert(peercert2, host) if msg: - raise util.Abort(_('%s certificate error: %s') % (host, msg), + raise error.Abort(_('%s certificate error: %s') % (host, msg), hint=_('configure hostfingerprint %s or use ' '--insecure to connect insecurely') % nicefingerprint) self.ui.debug('%s certificate successfully verified\n' % host) elif strict: - raise util.Abort(_('%s certificate with fingerprint %s not ' + raise error.Abort(_('%s certificate with fingerprint %s not ' 'verified') % (host, nicefingerprint), hint=_('check hostfingerprints or web.cacerts ' 'config setting'))
--- a/mercurial/statichttprepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/statichttprepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -171,9 +171,9 @@ return statichttppeer(self) def lock(self, wait=True): - raise util.Abort(_('cannot lock static-http repository')) + raise error.Abort(_('cannot lock static-http repository')) def instance(ui, path, create): if create: - raise util.Abort(_('cannot create new static-http repository')) + raise error.Abort(_('cannot create new static-http repository')) return statichttprepository(ui, path[7:])
--- a/mercurial/store.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/store.py Thu Oct 08 12:55:45 2015 -0700 @@ -6,7 +6,7 @@ # GNU General Public License version 2 or any later version. from i18n import _ -import scmutil, util, parsers +import scmutil, util, parsers, error import os, stat, errno _sha = util.sha1 @@ -405,7 +405,7 @@ for n, line in enumerate(fp): if not line.rstrip('\n'): t = _('invalid entry in fncache, line %s') % (n + 1) - raise util.Abort(t) + raise error.Abort(t) fp.close() def write(self, tr):
--- a/mercurial/streamclone.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/streamclone.py Thu Oct 08 12:55:45 2015 -0700 @@ -123,11 +123,11 @@ raise error.ResponseError( _('unexpected response from remote server:'), l) if resp == 1: - raise util.Abort(_('operation forbidden by server')) + raise error.Abort(_('operation forbidden by server')) elif resp == 2: - raise util.Abort(_('locking the remote repository failed')) + raise error.Abort(_('locking the remote repository failed')) elif resp != 0: - raise util.Abort(_('the server sent an unknown error code')) + raise error.Abort(_('the server sent an unknown error code')) l = fp.readline() try:
--- a/mercurial/subrepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/subrepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -95,7 +95,7 @@ return p.parse(f, data, sections, remap, read) else: - raise util.Abort(_("subrepo spec file \'%s\' not found") % + raise error.Abort(_("subrepo spec file \'%s\' not found") % repo.pathto(f)) if '.hgsub' in ctx: read('.hgsub') @@ -113,7 +113,7 @@ try: revision, path = l.split(" ", 1) except ValueError: - raise util.Abort(_("invalid subrepository revision " + raise error.Abort(_("invalid subrepository revision " "specifier in \'%s\' line %d") % (repo.pathto('.hgsubstate'), (i + 1))) rev[path] = revision @@ -133,7 +133,7 @@ try: src = re.sub(pattern, repl, src, 1) except re.error as e: - raise util.Abort(_("bad subrepository pattern in %s: %s") + raise error.Abort(_("bad subrepository pattern in %s: %s") % (p.source('subpaths', pattern), e)) return src @@ -142,7 +142,7 @@ kind = 'hg' if src.startswith('['): if ']' not in src: - raise util.Abort(_('missing ] in subrepo source')) + raise error.Abort(_('missing ] in subrepo source')) kind, src = src.split(']', 1) kind = kind[1:] src = src.lstrip() # strip any extra whitespace after ']' @@ -324,7 +324,7 @@ # chop off the .hg component to get the default path form return os.path.dirname(repo.sharedpath) if abort: - raise util.Abort(_("default path for subrepository not found")) + raise error.Abort(_("default path for subrepository not found")) def _sanitize(ui, vfs, ignore): for dirname, dirs, names in vfs.walk(): @@ -353,7 +353,7 @@ pathutil.pathauditor(ctx.repo().root)(path) state = ctx.substate[path] if state[2] not in types: - raise util.Abort(_('unknown subrepo type %s') % state[2]) + raise error.Abort(_('unknown subrepo type %s') % state[2]) if allowwdir: state = (state[0], ctx.subrev(path), state[2]) return types[state[2]](ctx, path, state[:2]) @@ -371,7 +371,7 @@ pathutil.pathauditor(ctx.repo().root)(path) state = ctx.substate[path] if state[2] not in types: - raise util.Abort(_('unknown subrepo type %s') % state[2]) + raise error.Abort(_('unknown subrepo type %s') % state[2]) subrev = '' if state[2] == 'hg': subrev = "0" * 40 @@ -384,7 +384,7 @@ return commitphase check = ui.config('phases', 'checksubrepos', 'follow') if check not in ('ignore', 'follow', 'abort'): - raise util.Abort(_('invalid phases.checksubrepos configuration: %s') + raise error.Abort(_('invalid phases.checksubrepos configuration: %s') % (check)) if check == 'ignore': return commitphase @@ -398,7 +398,7 @@ maxsub = s if commitphase < maxphase: if check == 'abort': - raise util.Abort(_("can't commit in %s phase" + raise error.Abort(_("can't commit in %s phase" " conflicting %s from subrepository %s") % (phases.phasenames[commitphase], phases.phasenames[maxphase], maxsub)) @@ -456,7 +456,7 @@ """ dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate) if dirtyreason: - raise util.Abort(dirtyreason) + raise error.Abort(dirtyreason) def basestate(self): """current working directory base state, disregarding .hgsubstate @@ -1073,7 +1073,7 @@ self._state = state self._exe = util.findexe('svn') if not self._exe: - raise util.Abort(_("'svn' executable not found for subrepo '%s'") + raise error.Abort(_("'svn' executable not found for subrepo '%s'") % self._path) def _svncommand(self, commands, filename='', failok=False): @@ -1108,7 +1108,8 @@ stderr = stderr.strip() if not failok: if p.returncode: - raise util.Abort(stderr or 'exited with code %d' % p.returncode) + raise error.Abort(stderr or 'exited with code %d' + % p.returncode) if stderr: self.ui.warn(stderr + '\n') return stdout, stderr @@ -1118,7 +1119,7 @@ output, err = self._svncommand(['--version', '--quiet'], filename=None) m = re.search(r'^(\d+)\.(\d+)', output) if not m: - raise util.Abort(_('cannot retrieve svn tool version')) + raise error.Abort(_('cannot retrieve svn tool version')) return (int(m.group(1)), int(m.group(2))) def _wcrevs(self): @@ -1196,11 +1197,11 @@ return self.basestate() if extchanged: # Do not try to commit externals - raise util.Abort(_('cannot commit svn externals')) + raise error.Abort(_('cannot commit svn externals')) if missing: # svn can commit with missing entries but aborting like hg # seems a better approach. - raise util.Abort(_('cannot commit missing svn entries')) + raise error.Abort(_('cannot commit missing svn entries')) commitinfo, err = self._svncommand(['commit', '-m', text]) self.ui.status(commitinfo) newrev = re.search('Committed revision ([0-9]+).', commitinfo) @@ -1210,8 +1211,8 @@ # svn one. For instance, svn ignores missing files # when committing. If there are only missing files, no # commit is made, no output and no error code. - raise util.Abort(_('failed to commit svn changes')) - raise util.Abort(commitinfo.splitlines()[-1]) + raise error.Abort(_('failed to commit svn changes')) + raise error.Abort(commitinfo.splitlines()[-1]) newrev = newrev.groups()[0] self.ui.status(self._svncommand(['update', '-r', newrev])[0]) return newrev @@ -1250,7 +1251,7 @@ self.remove() self.get(state, overwrite=False) return - raise util.Abort((status or err).splitlines()[-1]) + raise error.Abort((status or err).splitlines()[-1]) self.ui.status(status) @annotatesubrepoerror @@ -1307,7 +1308,7 @@ if versionstatus == 'unknown': self.ui.warn(_('cannot retrieve git version\n')) elif versionstatus == 'abort': - raise util.Abort(_('git subrepo requires at least 1.6.0 or later')) + raise error.Abort(_('git subrepo requires at least 1.6.0 or later')) elif versionstatus == 'warning': self.ui.warn(_('git subrepo requires at least 1.6.0 or later\n')) @@ -1394,7 +1395,7 @@ if command in ('cat-file', 'symbolic-ref'): return retdata, p.returncode # for all others, abort - raise util.Abort('git %s error %d in %s' % + raise error.Abort('git %s error %d in %s' % (command, p.returncode, self._relpath)) return retdata, p.returncode @@ -1491,7 +1492,7 @@ # try only origin: the originally cloned repo self._gitcommand(['fetch']) if not self._githavelocally(revision): - raise util.Abort(_("revision %s does not exist in subrepo %s\n") % + raise error.Abort(_("revision %s does not exist in subrepo %s\n") % (revision, self._relpath)) @annotatesubrepoerror @@ -1600,7 +1601,7 @@ @annotatesubrepoerror def commit(self, text, user, date): if self._gitmissing(): - raise util.Abort(_("subrepo %s is missing") % self._relpath) + raise error.Abort(_("subrepo %s is missing") % self._relpath) cmd = ['commit', '-a', '-m', text] env = os.environ.copy() if user: @@ -1646,7 +1647,7 @@ if not self._state[1]: return True if self._gitmissing(): - raise util.Abort(_("subrepo %s is missing") % self._relpath) + raise error.Abort(_("subrepo %s is missing") % self._relpath) # if a branch in origin contains the revision, nothing to do branch2rev, rev2branch = self._gitbranchmap() if self._state[1] in rev2branch:
--- a/mercurial/templater.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/templater.py Thu Oct 08 12:55:45 2015 -0700 @@ -270,7 +270,7 @@ dt = arg[1][1] else: dt = arg[1] - raise util.Abort(_("template filter '%s' is not compatible with " + raise error.Abort(_("template filter '%s' is not compatible with " "keyword '%s'") % (filt.func_name, dt)) def buildmap(exp, context): @@ -840,7 +840,7 @@ stylelist.append(split[1]) return ", ".join(sorted(stylelist)) -class TemplateNotFound(util.Abort): +class TemplateNotFound(error.Abort): pass class templater(object): @@ -873,7 +873,7 @@ if not mapfile: return if not os.path.exists(mapfile): - raise util.Abort(_("style '%s' not found") % mapfile, + raise error.Abort(_("style '%s' not found") % mapfile, hint=_("available styles: %s") % stylelist()) conf = config.config(includepaths=templatepaths())
--- a/mercurial/transaction.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/transaction.py Thu Oct 08 12:55:45 2015 -0700 @@ -71,7 +71,7 @@ except (IOError, OSError) as inst: if inst.errno != errno.ENOENT: raise - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: if not c: raise @@ -83,7 +83,7 @@ for f in backupfiles: if opener.exists(f): opener.unlink(f) - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: # only pure backup file remains, it is sage to ignore any error pass @@ -417,7 +417,7 @@ if not f and b and vfs.exists(b): try: vfs.unlink(b) - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: if not c: raise # Abort may be raise by read only opener @@ -440,7 +440,7 @@ if b and vfs.exists(b): try: vfs.unlink(b) - except (IOError, OSError, util.Abort) as inst: + except (IOError, OSError, error.Abort) as inst: if not c: raise # Abort may be raise by read only opener
--- a/mercurial/treediscovery.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/treediscovery.py Thu Oct 08 12:55:45 2015 -0700 @@ -16,7 +16,6 @@ ) from . import ( error, - util, ) def findcommonincoming(repo, remote, heads=None, force=False): @@ -149,7 +148,7 @@ if force: repo.ui.warn(_("warning: repository is unrelated\n")) else: - raise util.Abort(_("repository is unrelated")) + raise error.Abort(_("repository is unrelated")) repo.ui.debug("found new changesets starting at " + " ".join([short(f) for f in fetch]) + "\n")
--- a/mercurial/ui.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/ui.py Thu Oct 08 12:55:45 2015 -0700 @@ -535,11 +535,12 @@ except KeyError: pass if not user: - raise util.Abort(_('no username supplied'), + raise error.Abort(_('no username supplied'), hint=_('use "hg config --edit" ' 'to set your username')) if "\n" in user: - raise util.Abort(_("username %s contains a newline\n") % repr(user)) + raise error.Abort(_("username %s contains a newline\n") + % repr(user)) return user def shortuser(self, user): @@ -755,7 +756,7 @@ self.write(r, "\n") return r except EOFError: - raise util.Abort(_('response expected')) + raise error.Abort(_('response expected')) @staticmethod def extractchoices(prompt): @@ -802,7 +803,7 @@ else: return getpass.getpass('') except EOFError: - raise util.Abort(_('response expected')) + raise error.Abort(_('response expected')) def status(self, *msg, **opts): '''write status message to output (if ui.quiet is False) @@ -858,7 +859,7 @@ self.system("%s \"%s\"" % (editor, name), environ=environ, - onerr=util.Abort, errprefix=_("edit failed")) + onerr=error.Abort, errprefix=_("edit failed")) f = open(name) t = f.read()
--- a/mercurial/unionrepo.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/unionrepo.py Thu Oct 08 12:55:45 2015 -0700 @@ -21,6 +21,7 @@ from . import ( changelog, cmdutil, + error, filelog, localrepo, manifest, @@ -231,7 +232,7 @@ def instance(ui, path, create): if create: - raise util.Abort(_('cannot create new union repository')) + raise error.Abort(_('cannot create new union repository')) parentpath = ui.config("bundle", "mainreporoot", "") if not parentpath: # try to find the correct path to the working directory repo
--- a/mercurial/url.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/url.py Thu Oct 08 12:55:45 2015 -0700 @@ -19,6 +19,7 @@ from .i18n import _ from . import ( + error, httpconnection as httpconnectionmod, keepalive, sslutil, @@ -48,7 +49,7 @@ u = util.url(authuri) u.query = None if not self.ui.interactive(): - raise util.Abort(_('http authorization required for %s') % + raise error.Abort(_('http authorization required for %s') % util.hidepassword(str(u))) self.ui.write(_("http authorization required for %s\n") %
--- a/mercurial/util.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/util.py Thu Oct 08 12:55:45 2015 -0700 @@ -1925,7 +1925,7 @@ If port is an integer, it's returned as is. If it's a string, it's looked up using socket.getservbyname(). If there's no matching - service, util.Abort is raised. + service, error.Abort is raised. """ try: return int(port)
--- a/mercurial/verify.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/verify.py Thu Oct 08 12:55:45 2015 -0700 @@ -50,7 +50,7 @@ lrugetctx = util.lrucachefunc(repo.changectx) if not repo.url().startswith('file:'): - raise util.Abort(_("cannot verify bundle or remote repos")) + raise error.Abort(_("cannot verify bundle or remote repos")) def err(linkrev, msg, filename=None): if linkrev is not None:
--- a/mercurial/wireproto.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/wireproto.py Thu Oct 08 12:55:45 2015 -0700 @@ -690,7 +690,7 @@ try: r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key), encoding.tolocal(old), new) or False - except util.Abort: + except error.Abort: r = False output = proto.restore() @@ -752,12 +752,12 @@ fp.close() os.unlink(tempname) - except (error.BundleValueError, util.Abort, error.PushRaced) as exc: + except (error.BundleValueError, error.Abort, error.PushRaced) as exc: # handle non-bundle2 case first if not getattr(exc, 'duringunbundle2', False): try: raise - except util.Abort: + except error.Abort: # The old code we moved used sys.stderr directly. # We did not change it to minimise code change. # This need to be moved to something proper. @@ -798,7 +798,7 @@ errpart.addparam('parttype', exc.parttype) if exc.params: errpart.addparam('params', '\0'.join(exc.params)) - except util.Abort as exc: + except error.Abort as exc: manargs = [('message', str(exc))] advargs = [] if exc.hint is not None:
--- a/mercurial/worker.py Mon Oct 05 22:49:24 2015 -0700 +++ b/mercurial/worker.py Thu Oct 08 12:55:45 2015 -0700 @@ -14,7 +14,7 @@ import threading from .i18n import _ -from . import util +from . import error def countcpus(): '''try to count the number of CPUs on the system''' @@ -45,7 +45,7 @@ if n >= 1: return n except ValueError: - raise util.Abort(_('number of cpus must be an integer')) + raise error.Abort(_('number of cpus must be an integer')) return min(max(countcpus(), 4), 32) if os.name == 'posix':
--- a/tests/autodiff.py Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/autodiff.py Thu Oct 08 12:55:45 2015 -0700 @@ -1,7 +1,7 @@ # Extension dedicated to test patch.diff() upgrade modes # # -from mercurial import cmdutil, scmutil, patch, util +from mercurial import cmdutil, scmutil, patch, error cmdtable = {} command = cmdutil.command(cmdtable) @@ -30,9 +30,9 @@ diffopts.git = False diffopts.upgrade = True def losedatafn(fn=None, **kwargs): - raise util.Abort('losing data for %s' % fn) + raise error.Abort('losing data for %s' % fn) else: - raise util.Abort('--git must be yes, no or auto') + raise error.Abort('--git must be yes, no or auto') node1, node2 = scmutil.revpair(repo, []) m = scmutil.match(repo[node2], pats, opts)
--- a/tests/test-abort-checkin.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-abort-checkin.t Thu Oct 08 12:55:45 2015 -0700 @@ -1,7 +1,7 @@ $ cat > abortcommit.py <<EOF - > from mercurial import util + > from mercurial import error > def hook(**args): - > raise util.Abort("no commits allowed") + > raise error.Abort("no commits allowed") > def reposetup(ui, repo): > repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook) > EOF
--- a/tests/test-addremove-similar.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-addremove-similar.t Thu Oct 08 12:55:45 2015 -0700 @@ -69,7 +69,7 @@ $ cd .. -Issue1527: repeated addremove causes util.Abort +Issue1527: repeated addremove causes Abort $ hg init rep3; cd rep3 $ mkdir d
--- a/tests/test-annotate.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-annotate.t Thu Oct 08 12:55:45 2015 -0700 @@ -299,7 +299,7 @@ and its ancestor by overriding "repo._filecommit". $ cat > ../legacyrepo.py <<EOF - > from mercurial import node, util + > from mercurial import node, error > def reposetup(ui, repo): > class legacyrepo(repo.__class__): > def _filecommit(self, fctx, manifest1, manifest2, @@ -312,12 +312,12 @@ > meta = {} > copy = fctx.renamed() > if copy and copy[0] != fname: - > raise util.Abort('copying is not supported') + > raise error.Abort('copying is not supported') > if fparent2 != node.nullid: > changelist.append(fname) > return flog.add(text, meta, tr, linkrev, > fparent1, fparent2) - > raise util.Abort('only merging is supported') + > raise error.Abort('only merging is supported') > repo.__class__ = legacyrepo > EOF
--- a/tests/test-bundle2-exchange.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-bundle2-exchange.t Thu Oct 08 12:55:45 2015 -0700 @@ -453,7 +453,7 @@ > used to test error handling in bundle2 > """ > - > from mercurial import util + > from mercurial import error > from mercurial import bundle2 > from mercurial import exchange > from mercurial import extensions @@ -471,7 +471,7 @@ > > @bundle2.parthandler("test:abort") > def handleabort(op, part): - > raise util.Abort('Abandon ship!', hint="don't panic") + > raise error.Abort('Abandon ship!', hint="don't panic") > > def uisetup(ui): > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
--- a/tests/test-bundle2-format.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-bundle2-format.t Thu Oct 08 12:55:45 2015 -0700 @@ -90,7 +90,7 @@ > try: > bundler.addparam(*p) > except ValueError, exc: - > raise util.Abort('%s' % exc) + > raise error.Abort('%s' % exc) > > if opts['compress']: > bundler.setcompression(opts['compress']) @@ -164,7 +164,7 @@ > for chunk in bundler.getchunks(): > file.write(chunk) > except RuntimeError, exc: - > raise util.Abort(exc) + > raise error.Abort(exc) > > @command('unbundle2', [], '') > def cmdunbundle2(ui, repo, replypath=None): @@ -178,9 +178,9 @@ > op = bundle2.processbundle(repo, unbundler, lambda: tr) > tr.close() > except error.BundleValueError, exc: - > raise util.Abort('missing support for %s' % exc) + > raise error.Abort('missing support for %s' % exc) > except error.PushRaced, exc: - > raise util.Abort('push race: %s' % exc) + > raise error.Abort('push race: %s' % exc) > finally: > if tr is not None: > tr.release() @@ -204,7 +204,7 @@ > try: > params = unbundler.params > except error.BundleValueError, exc: - > raise util.Abort('unknown parameters: %s' % exc) + > raise error.Abort('unknown parameters: %s' % exc) > ui.write('options count: %i\n' % len(params)) > for key in sorted(params): > ui.write('- %s\n' % key)
--- a/tests/test-custom-filters.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-custom-filters.t Thu Oct 08 12:55:45 2015 -0700 @@ -10,11 +10,11 @@ > EOF $ cat > prefix.py <<EOF - > from mercurial import util + > from mercurial import error > def stripprefix(s, cmd, filename, **kwargs): > header = '%s\n' % cmd > if s[:len(header)] != header: - > raise util.Abort('missing header "%s" in %s' % (cmd, filename)) + > raise error.Abort('missing header "%s" in %s' % (cmd, filename)) > return s[len(header):] > def insertprefix(s, cmd): > return '%s\n%s' % (cmd, s)
--- a/tests/test-dirstate.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-dirstate.t Thu Oct 08 12:55:45 2015 -0700 @@ -66,10 +66,10 @@ coherent (issue4353) $ cat > ../dirstateexception.py <<EOF - > from mercurial import merge, extensions, util + > from mercurial import merge, extensions, error > > def wraprecordupdates(orig, repo, actions, branchmerge): - > raise util.Abort("simulated error while recording dirstateupdates") + > raise error.Abort("simulated error while recording dirstateupdates") > > def reposetup(ui, repo): > extensions.wrapfunction(merge, 'recordupdates', wraprecordupdates)
--- a/tests/test-fncache.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-fncache.t Thu Oct 08 12:55:45 2015 -0700 @@ -202,12 +202,12 @@ $ cat > exceptionext.py <<EOF > import os - > from mercurial import commands, util + > from mercurial import commands, error > from mercurial.extensions import wrapfunction > > def lockexception(orig, vfs, lockname, wait, releasefn, *args, **kwargs): > def releasewrap(): - > raise util.Abort("forced lock failure") + > raise error.Abort("forced lock failure") > return orig(vfs, lockname, wait, releasewrap, *args, **kwargs) > > def reposetup(ui, repo): @@ -231,13 +231,13 @@ $ cat > ../exceptionext.py <<EOF > import os - > from mercurial import commands, util, localrepo + > from mercurial import commands, error, localrepo > from mercurial.extensions import wrapfunction > > def wrapper(orig, self, *args, **kwargs): > tr = orig(self, *args, **kwargs) > def fail(tr): - > raise util.Abort("forced transaction failure") + > raise error.Abort("forced transaction failure") > # zzz prefix to ensure it sorted after store.write > tr.addfinalize('zzz-forcefails', fail) > return tr @@ -262,19 +262,19 @@ $ cat > ../exceptionext.py <<EOF > import os - > from mercurial import commands, util, transaction, localrepo + > from mercurial import commands, error, transaction, localrepo > from mercurial.extensions import wrapfunction > > def trwrapper(orig, self, *args, **kwargs): > tr = orig(self, *args, **kwargs) > def fail(tr): - > raise util.Abort("forced transaction failure") + > raise error.Abort("forced transaction failure") > # zzz prefix to ensure it sorted after store.write > tr.addfinalize('zzz-forcefails', fail) > return tr > > def abortwrapper(orig, self, *args, **kwargs): - > raise util.Abort("forced transaction failure") + > raise error.Abort("forced transaction failure") > > def uisetup(ui): > wrapfunction(localrepo.localrepository, 'transaction', trwrapper)
--- a/tests/test-histedit-edit.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-histedit-edit.t Thu Oct 08 12:55:45 2015 -0700 @@ -298,11 +298,11 @@ check saving last-message.txt, at first $ cat > $TESTTMP/commitfailure.py <<EOF - > from mercurial import util + > from mercurial import error > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise util.Abort('emulating unexpected abort') + > raise error.Abort('emulating unexpected abort') > repo.__class__ = commitfailure > EOF $ cat >> .hg/hgrc <<EOF
--- a/tests/test-hook.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-hook.t Thu Oct 08 12:55:45 2015 -0700 @@ -394,7 +394,7 @@ $ cd "$TESTTMP/b" $ cat > hooktests.py <<EOF - > from mercurial import util + > from mercurial import error > > uncallable = 0 > @@ -421,7 +421,7 @@ > raise LocalException('exception from hook') > > def aborthook(**args): - > raise util.Abort('raise abort from hook') + > raise error.Abort('raise abort from hook') > > def brokenhook(**args): > return 1 + {}
--- a/tests/test-lock-badness.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-lock-badness.t Thu Oct 08 12:55:45 2015 -0700 @@ -14,7 +14,7 @@ Test that raising an exception in the release function doesn't cause the lock to choke $ cat > testlock.py << EOF - > from mercurial import cmdutil, error, util + > from mercurial import cmdutil, error, error > > cmdtable = {} > command = cmdutil.command(cmdtable) @@ -22,7 +22,7 @@ > def acquiretestlock(repo, releaseexc): > def unlock(): > if releaseexc: - > raise util.Abort('expected release exception') + > raise error.Abort('expected release exception') > l = repo._lock(repo.vfs, 'testlock', False, unlock, None, 'test lock') > return l > @@ -35,7 +35,7 @@ > try: > testlock = acquiretestlock(repo, False) > except error.LockHeld: - > raise util.Abort('lockfile on disk even after releasing!') + > raise error.Abort('lockfile on disk even after releasing!') > testlock.release() > EOF $ cat >> $HGRCPATH << EOF
--- a/tests/test-merge1.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-merge1.t Thu Oct 08 12:55:45 2015 -0700 @@ -214,10 +214,10 @@ $ cat > $TESTTMP/abort.py <<EOF > # emulate aborting before "recordupdates()". in this case, files > # are changed without updating dirstate - > from mercurial import extensions, merge, util + > from mercurial import extensions, merge, error > def applyupdates(orig, *args, **kwargs): > orig(*args, **kwargs) - > raise util.Abort('intentional aborting') + > raise error.Abort('intentional aborting') > def extsetup(ui): > extensions.wrapfunction(merge, "applyupdates", applyupdates) > EOF
--- a/tests/test-mq-qfold.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-mq-qfold.t Thu Oct 08 12:55:45 2015 -0700 @@ -149,11 +149,11 @@ $ hg qrefresh -m "original message" $ cat > $TESTTMP/commitfailure.py <<EOF - > from mercurial import util + > from mercurial import error > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise util.Abort('emulating unexpected abort') + > raise error.Abort('emulating unexpected abort') > repo.__class__ = commitfailure > EOF
--- a/tests/test-mq-qnew.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-mq-qnew.t Thu Oct 08 12:55:45 2015 -0700 @@ -248,11 +248,11 @@ $ cd repo $ cat > $TESTTMP/commitfailure.py <<EOF - > from mercurial import util + > from mercurial import error > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise util.Abort('emulating unexpected abort') + > raise error.Abort('emulating unexpected abort') > repo.__class__ = commitfailure > EOF $ cat >> .hg/hgrc <<EOF
--- a/tests/test-mq-qrefresh-replace-log-message.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-mq-qrefresh-replace-log-message.t Thu Oct 08 12:55:45 2015 -0700 @@ -108,11 +108,11 @@ > EOF $ cat > $TESTTMP/commitfailure.py <<EOF - > from mercurial import util + > from mercurial import error > def reposetup(ui, repo): > class commitfailure(repo.__class__): > def commit(self, *args, **kwargs): - > raise util.Abort('emulating unexpected abort') + > raise error.Abort('emulating unexpected abort') > repo.__class__ = commitfailure > EOF
--- a/tests/test-simplemerge.py Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-simplemerge.py Thu Oct 08 12:55:45 2015 -0700 @@ -15,7 +15,7 @@ import unittest from unittest import TestCase -from mercurial import util, simplemerge +from mercurial import util, simplemerge, error # bzr compatible interface, for the tests class Merge3(simplemerge.Merge3Text): @@ -29,7 +29,7 @@ atext = '\n'.join([i.strip('\n') for i in a] + ['']) btext = '\n'.join([i.strip('\n') for i in b] + ['']) if util.binary(basetext) or util.binary(atext) or util.binary(btext): - raise util.Abort("don't know how to merge binary files") + raise error.Abort("don't know how to merge binary files") simplemerge.Merge3Text.__init__(self, basetext, atext, btext, base, a, b) @@ -321,7 +321,7 @@ self.assertEquals(ml, MERGED_RESULT) def test_binary(self): - self.assertRaises(util.Abort, Merge3, ['\x00'], ['a'], ['b']) + self.assertRaises(error.Abort, Merge3, ['\x00'], ['a'], ['b']) def test_dos_text(self): base_text = 'a\r\n'
--- a/tests/test-subrepo.t Mon Oct 05 22:49:24 2015 -0700 +++ b/tests/test-subrepo.t Thu Oct 08 12:55:45 2015 -0700 @@ -1028,8 +1028,8 @@ Ensure a full traceback, not just the SubrepoAbort part - $ hg -R issue1852b update --traceback 2>&1 | grep 'raise util\.Abort' - raise util.Abort(_("default path for subrepository not found")) + $ hg -R issue1852b update --traceback 2>&1 | grep 'raise error\.Abort' + raise error.Abort(_("default path for subrepository not found")) Pull -u now doesn't help