# HG changeset patch # User liscju # Date 2016-06-14 09:53:55 # Node ID 98e8313dcd9e98c67d65de9ee49c88082406cb3f # Parent f694e20193f20548fdc4a89062bef99781d58c39 i18n: translate abort messages I found a few places where message given to abort is not translated, I don't find any reason to not translate them. diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -291,7 +291,7 @@ class bundlerepository(localrepo.localre ".cg%sun" % version) if cgstream is None: - raise error.Abort('No changegroups found') + raise error.Abort(_('No changegroups found')) cgstream.seek(0) self.bundle = changegroup.getunbundler(version, cgstream, 'UN') diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -858,14 +858,14 @@ def _pushbundle2(pushop): try: reply = pushop.remote.unbundle(stream, ['force'], 'push') except error.BundleValueError as exc: - raise error.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 error.Abort('missing support for %s' % exc) + raise error.Abort(_('missing support for %s') % exc) except bundle2.AbortFromPart as exc: pushop.ui.status(_('remote: %s\n') % exc) raise error.Abort(_('push failed on remote'), hint=exc.hint) @@ -1325,7 +1325,7 @@ def _pullbundle2(pullop): try: op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) except error.BundleValueError as exc: - raise error.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']] diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -484,7 +484,8 @@ def clone(ui, peeropts, source, dest=Non sharepath = os.path.join( sharepool, hashlib.sha1(source).hexdigest()) else: - raise error.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, diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -968,7 +968,7 @@ class manifest(revlog.revlog): return self.readdelta(node) if self._usemanifestv2: raise error.Abort( - "readshallowdelta() not implemented for manifestv2") + _("readshallowdelta() not implemented for manifestv2")) r = self.rev(node) d = mdiff.patchtext(self.revdiff(self.deltaparent(r), r)) return manifestdict(d) diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -38,7 +38,7 @@ def _expandsets(kindpats, ctx, listsubre for kind, pat, source in kindpats: if kind == 'set': if not ctx: - raise error.Abort("fileset expression with no context") + raise error.Abort(_("fileset expression with no context")) s = ctx.getfileset(pat) fset.update(s) diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -600,8 +600,8 @@ class obsstore(object): Take care of filtering duplicate. Return the number of new marker.""" if self._readonly: - raise error.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: @@ -1234,7 +1234,7 @@ def createmarkers(repo, relations, flag= localmetadata.update(rel[2]) if not prec.mutable(): - raise error.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() @@ -1243,7 +1243,8 @@ def createmarkers(repo, relations, flag= if not nsucs: npare = tuple(p.node() for p in prec.parents()) if nprec in nsucs: - raise error.Abort("changeset %s cannot obsolete itself" % prec) + raise error.Abort(_("changeset %s cannot obsolete itself") + % prec) # Creating the marker causes the hidden cache to become invalid, # which causes recomputation when we ask for prec.parents() above. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2663,7 +2663,8 @@ def formatspec(expr, *args): ret += listexp(list(args[arg]), d) arg += 1 else: - raise error.Abort('unexpected revspec format character %s' % d) + raise error.Abort(_('unexpected revspec format character %s') + % d) else: ret += c pos += 1 diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -468,7 +468,8 @@ class abstractvfs(object): # have a use case. vfs = getattr(self, 'vfs', self) if getattr(vfs, '_backgroundfilecloser', None): - raise error.Abort('can only have 1 active background file closer') + raise error.Abort( + _('can only have 1 active background file closer')) with backgroundfilecloser(ui, expectedcount=expectedcount) as bfc: try: @@ -590,8 +591,9 @@ class vfs(abstractvfs): if backgroundclose: if not self._backgroundfilecloser: - raise error.Abort('backgroundclose can only be used when a ' + raise error.Abort(_('backgroundclose can only be used when a ' 'backgroundclosing context manager is active') + ) fp = delayclosedfile(fp, self._backgroundfilecloser) @@ -662,7 +664,7 @@ class readonlyvfs(abstractvfs, auditvfs) def __call__(self, path, mode='r', *args, **kw): if mode not in ('r', 'rb'): - raise error.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): @@ -1383,8 +1385,8 @@ class backgroundfilecloser(object): def close(self, fh): """Schedule a file for closing.""" if not self._entered: - raise error.Abort('can only call close() when context manager ' - 'active') + raise error.Abort(_('can only call close() when context manager ' + 'active')) # If a background thread encountered an exception, raise now so we fail # fast. Otherwise we may potentially go on for minutes until the error diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -307,7 +307,7 @@ class sshpeer(wireproto.wirepeer): r = self._call(cmd, **args) if r: # XXX needs to be made better - raise error.Abort('unexpected remote reply: %s' % r) + raise error.Abort(_('unexpected remote reply: %s') % r) while True: d = fp.read(4096) if not d: diff --git a/mercurial/sshserver.py b/mercurial/sshserver.py --- a/mercurial/sshserver.py +++ b/mercurial/sshserver.py @@ -11,6 +11,7 @@ from __future__ import absolute_import import os import sys +from .i18n import _ from . import ( error, hook, @@ -40,7 +41,7 @@ class sshserver(wireproto.abstractserver argline = self.fin.readline()[:-1] arg, l = argline.split() if arg not in keys: - raise error.Abort("unexpected parameter %r" % arg) + raise error.Abort(_("unexpected parameter %r") % arg) if arg == '*': star = {} for k in xrange(int(l)): diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py --- a/mercurial/sslutil.py +++ b/mercurial/sslutil.py @@ -76,15 +76,15 @@ except AttributeError: def load_verify_locations(self, cafile=None, capath=None, cadata=None): if capath: - raise error.Abort('capath not supported') + raise error.Abort(_('capath not supported')) if cadata: - raise error.Abort('cadata not supported') + raise error.Abort(_('cadata not supported')) self._cacerts = cafile def set_ciphers(self, ciphers): if not self._supportsciphers: - raise error.Abort('setting ciphers not supported') + raise error.Abort(_('setting ciphers not supported')) self._ciphers = ciphers @@ -229,7 +229,7 @@ def wrapsocket(sock, keyfile, certfile, to use. """ if not serverhostname: - raise error.Abort('serverhostname argument is required') + raise error.Abort(_('serverhostname argument is required')) settings = _hostsettings(ui, serverhostname) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1414,7 +1414,7 @@ class gitsubrepo(abstractsubrepo): if command in ('cat-file', 'symbolic-ref'): return retdata, p.returncode # for all others, abort - raise error.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