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.
This commit is contained in:
liscju 2016-06-14 11:53:55 +02:00
parent 2acd032eb6
commit c7ec9d159e
12 changed files with 30 additions and 24 deletions

View File

@ -291,7 +291,7 @@ class bundlerepository(localrepo.localrepository):
".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')

View File

@ -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']]

View File

@ -484,7 +484,8 @@ def clone(ui, peeropts, source, dest=None, pull=False, rev=None,
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,

View File

@ -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)

View File

@ -38,7 +38,7 @@ def _expandsets(kindpats, ctx, listsubrepos):
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)

View File

@ -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=0, date=None, metadata=None):
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=0, date=None, metadata=None):
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.

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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.abstractserverproto):
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)):

View File

@ -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, ui, serverhostname=None):
to use.
"""
if not serverhostname:
raise error.Abort('serverhostname argument is required')
raise error.Abort(_('serverhostname argument is required'))
settings = _hostsettings(ui, serverhostname)

View File

@ -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