i18n: translate abort messages
authorliscju <piotr.listkiewicz@gmail.com>
Tue, 14 Jun 2016 11:53:55 +0200
changeset 29389 98e8313dcd9e
parent 29388 f694e20193f2
child 29390 9349b4073c11
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.
mercurial/bundlerepo.py
mercurial/exchange.py
mercurial/hg.py
mercurial/manifest.py
mercurial/match.py
mercurial/obsolete.py
mercurial/revset.py
mercurial/scmutil.py
mercurial/sshpeer.py
mercurial/sshserver.py
mercurial/sslutil.py
mercurial/subrepo.py
--- a/mercurial/bundlerepo.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/bundlerepo.py	Tue Jun 14 11:53:55 2016 +0200
@@ -291,7 +291,7 @@
                                                     ".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')
--- a/mercurial/exchange.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/exchange.py	Tue Jun 14 11:53:55 2016 +0200
@@ -858,14 +858,14 @@
         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 @@
     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']]
--- a/mercurial/hg.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/hg.py	Tue Jun 14 11:53:55 2016 +0200
@@ -484,7 +484,8 @@
             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,
--- a/mercurial/manifest.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/manifest.py	Tue Jun 14 11:53:55 2016 +0200
@@ -968,7 +968,7 @@
             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)
--- a/mercurial/match.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/match.py	Tue Jun 14 11:53:55 2016 +0200
@@ -38,7 +38,7 @@
     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)
 
--- a/mercurial/obsolete.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/obsolete.py	Tue Jun 14 11:53:55 2016 +0200
@@ -600,8 +600,8 @@
         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 @@
                 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 @@
             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.
--- a/mercurial/revset.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/revset.py	Tue Jun 14 11:53:55 2016 +0200
@@ -2663,7 +2663,8 @@
                 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
--- a/mercurial/scmutil.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/scmutil.py	Tue Jun 14 11:53:55 2016 +0200
@@ -468,7 +468,8 @@
         # 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 @@
 
         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 @@
 
     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 @@
     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
--- a/mercurial/sshpeer.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/sshpeer.py	Tue Jun 14 11:53:55 2016 +0200
@@ -307,7 +307,7 @@
         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:
--- a/mercurial/sshserver.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/sshserver.py	Tue Jun 14 11:53:55 2016 +0200
@@ -11,6 +11,7 @@
 import os
 import sys
 
+from .i18n import _
 from . import (
     error,
     hook,
@@ -40,7 +41,7 @@
             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)):
--- a/mercurial/sslutil.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/sslutil.py	Tue Jun 14 11:53:55 2016 +0200
@@ -76,15 +76,15 @@
 
         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 @@
       to use.
     """
     if not serverhostname:
-        raise error.Abort('serverhostname argument is required')
+        raise error.Abort(_('serverhostname argument is required'))
 
     settings = _hostsettings(ui, serverhostname)
 
--- a/mercurial/subrepo.py	Tue Jun 07 12:10:01 2016 +0200
+++ b/mercurial/subrepo.py	Tue Jun 14 11:53:55 2016 +0200
@@ -1414,7 +1414,7 @@
             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