[PATCH stable] progress: mark strings for translation

Wagner Bruna wagner.bruna+mercurial at gmail.com
Wed Feb 17 12:52:30 CST 2010


# HG changeset patch
# User Wagner Bruna <wbruna at softwareexpress.com.br>
# Date 1266432666 7200
# Branch stable
# Node ID bcf3398100abfde382d9509394dd6824c390e662
# Parent  0e64d814d7d0a4d3cce3bf91f5e3a1f3703fa642
progress: mark strings for translation

diff --git a/contrib/shrink-revlog.py b/contrib/shrink-revlog.py
--- a/contrib/shrink-revlog.py
+++ b/contrib/shrink-revlog.py
@@ -32,7 +32,7 @@
     ui.status('reading revs\n')
     try:
         for i in rl:
-            ui.progress('reading', i, total=len(rl))
+            ui.progress(_('reading'), i, total=len(rl))
             children[i] = []
             parents = [p for p in rl.parentrevs(i) if p != node.nullrev]
             # in case of duplicate parents
@@ -45,7 +45,7 @@
             if len(parents) == 0:
                 root.append(i)
     finally:
-        ui.progress('reading', None, total=len(rl))
+        ui.progress(_('reading'), None, total=len(rl))
 
     # XXX this is a reimplementation of the 'branchsort' topo sort
     # algorithm in hgext.convert.convcmd... would be nice not to duplicate
@@ -75,7 +75,7 @@
 
     count = [0]
     def progress(*args):
-        ui.progress('writing', count[0], total=len(order))
+        ui.progress(_('writing'), count[0], total=len(order))
         count[0] += 1
 
     order = [r1.node(r) for r in order]
@@ -89,7 +89,7 @@
         chunkiter = changegroup.chunkiter(group)
         r2.addgroup(chunkiter, unlookup, tr)
     finally:
-        ui.progress('writing', None, len(order))
+        ui.progress(_('writing'), None, len(order))
 
 def report(ui, olddatafn, newdatafn):
     oldsize = float(os.stat(olddatafn).st_size)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1339,7 +1339,7 @@
 
             if r:
                 reqcnt += 1
-                self.ui.progress('searching', reqcnt, unit='queries')
+                self.ui.progress(_('searching'), reqcnt, unit='queries')
                 self.ui.debug("request %d: %s\n" %
                             (reqcnt, " ".join(map(short, r))))
                 for p in xrange(0, len(r), 10):
@@ -1352,7 +1352,7 @@
         while search:
             newsearch = []
             reqcnt += 1
-            self.ui.progress('searching', reqcnt, unit='queries')
+            self.ui.progress(_('searching'), reqcnt, unit='queries')
             for n, l in zip(search, remote.between(search)):
                 l.append(n[1])
                 p = n[0]
@@ -1388,7 +1388,7 @@
         self.ui.debug("found new changesets starting at " +
                      " ".join([short(f) for f in fetch]) + "\n")
 
-        self.ui.progress('searching', None, unit='queries')
+        self.ui.progress(_('searching'), None, unit='queries')
         self.ui.debug("%d total queries\n" % reqcnt)
 
         return base.keys(), list(fetch), heads
@@ -1819,9 +1819,9 @@
             cnt = 0
             for chnk in group:
                 yield chnk
-                self.ui.progress('bundle changes', cnt, unit='chunks')
+                self.ui.progress(_('bundle changes'), cnt, unit='chunks')
                 cnt += 1
-            self.ui.progress('bundle changes', None, unit='chunks')
+            self.ui.progress(_('bundle changes'), None, unit='chunks')
 
 
             # Figure out which manifest nodes (of the ones we think might be
@@ -1847,9 +1847,9 @@
             cnt = 0
             for chnk in group:
                 yield chnk
-                self.ui.progress('bundle manifests', cnt, unit='chunks')
+                self.ui.progress(_('bundle manifests'), cnt, unit='chunks')
                 cnt += 1
-            self.ui.progress('bundle manifests', None, unit='chunks')
+            self.ui.progress(_('bundle manifests'), None, unit='chunks')
 
             # These are no longer needed, dereference and toss the memory for
             # them.
@@ -1898,7 +1898,7 @@
                     del msng_filenode_set[fname]
             # Signal that no more groups are left.
             yield changegroup.closechunk()
-            self.ui.progress('bundle files', None, unit='chunks')
+            self.ui.progress(_('bundle files'), None, unit='chunks')
 
             if msng_cl_lst:
                 self.hook('outgoing', node=hex(msng_cl_lst[0]), source=source)
@@ -1947,19 +1947,19 @@
 
             cnt = 0
             for chnk in cl.group(nodes, identity, collect):
-                self.ui.progress('bundle changes', cnt, unit='chunks')
+                self.ui.progress(_('bundle changes'), cnt, unit='chunks')
                 cnt += 1
                 yield chnk
-            self.ui.progress('bundle changes', None, unit='chunks')
+            self.ui.progress(_('bundle changes'), None, unit='chunks')
 
             mnfst = self.manifest
             nodeiter = gennodelst(mnfst)
             cnt = 0
             for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)):
-                self.ui.progress('bundle manifests', cnt, unit='chunks')
+                self.ui.progress(_('bundle manifests'), cnt, unit='chunks')
                 cnt += 1
                 yield chnk
-            self.ui.progress('bundle manifests', None, unit='chunks')
+            self.ui.progress(_('bundle manifests'), None, unit='chunks')
 
             cnt = 0
             for fname in sorted(changedfiles):
@@ -2022,7 +2022,7 @@
             self.ui.status(_("adding changesets\n"))
             clstart = len(cl)
             class prog(object):
-                step = 'changesets'
+                step = _('changesets')
                 count = 1
                 ui = self.ui
                 def __call__(self):
@@ -2034,11 +2034,11 @@
                 raise util.Abort(_("received changelog group is empty"))
             clend = len(cl)
             changesets = clend - clstart
-            self.ui.progress('changesets', None)
+            self.ui.progress(_('changesets'), None)
 
             # pull off the manifest group
             self.ui.status(_("adding manifests\n"))
-            pr.step = 'manifests'
+            pr.step = _('manifests')
             pr.count = 1
             chunkiter = changegroup.chunkiter(source, progress=pr)
             # no need to check for empty manifest group here:
@@ -2046,7 +2046,7 @@
             # no new manifest will be created and the manifest group will
             # be empty during the pull
             self.manifest.addgroup(chunkiter, revmap, trp)
-            self.ui.progress('manifests', None)
+            self.ui.progress(_('manifests'), None)
 
             needfiles = {}
             if self.ui.configbool('server', 'validate', default=False):
@@ -2082,7 +2082,7 @@
                             needs.remove(n)
                     if not needs:
                         del needfiles[f]
-            self.ui.progress('files', None)
+            self.ui.progress(_('files'), None)
 
             for f, needs in needfiles.iteritems():
                 fl = self.file(f)
diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -122,7 +122,7 @@
     checklog(cl, "changelog", 0)
     total = len(repo)
     for i in repo:
-        ui.progress('changelog', i, total=total)
+        ui.progress(_('changelog'), i, total=total)
         n = cl.node(i)
         checkentry(cl, i, n, seen, [i], "changelog")
 
@@ -133,14 +133,14 @@
                 filelinkrevs.setdefault(f, []).append(i)
         except Exception, inst:
             exc(i, _("unpacking changeset %s") % short(n), inst)
-    ui.progress('changelog', None)
+    ui.progress(_('changelog'), None)
 
     ui.status(_("checking manifests\n"))
     seen = {}
     checklog(mf, "manifest", 0)
     total = len(mf)
     for i in mf:
-        ui.progress('manifests', i, total=total)
+        ui.progress(_('manifests'), i, total=total)
         n = mf.node(i)
         lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")
         if n in mflinkrevs:
@@ -156,7 +156,7 @@
                     filenodes.setdefault(f, {}).setdefault(fn, lr)
         except Exception, inst:
             exc(lr, _("reading manifest delta %s") % short(n), inst)
-    ui.progress('manifests', None)
+    ui.progress(_('manifests'), None)
 
     ui.status(_("crosschecking files in changesets and manifests\n"))
 
@@ -166,13 +166,13 @@
         for c, m in sorted([(c, m) for m in mflinkrevs
                             for c in mflinkrevs[m]]):
             count += 1
-            ui.progress('crosscheck', count, total=total)
+            ui.progress(_('crosscheck'), count, total=total)
             err(c, _("changeset refers to unknown manifest %s") % short(m))
         mflinkrevs = None # del is bad here due to scope issues
 
         for f in sorted(filelinkrevs):
             count += 1
-            ui.progress('crosscheck', count, total=total)
+            ui.progress(_('crosscheck'), count, total=total)
             if f not in filenodes:
                 lr = filelinkrevs[f][0]
                 err(lr, _("in changeset but not in manifest"), f)
@@ -180,7 +180,7 @@
     if havecl:
         for f in sorted(filenodes):
             count += 1
-            ui.progress('crosscheck', count, total=total)
+            ui.progress(_('crosscheck'), count, total=total)
             if f not in filelinkrevs:
                 try:
                     fl = repo.file(f)
@@ -189,7 +189,7 @@
                     lr = None
                 err(lr, _("in manifest but not in changeset"), f)
 
-    ui.progress('crosscheck', None)
+    ui.progress(_('crosscheck'), None)
 
     ui.status(_("checking files\n"))
 
@@ -203,7 +203,7 @@
     files = sorted(set(filenodes) | set(filelinkrevs))
     total = len(files)
     for i, f in enumerate(files):
-        ui.progress('files', i, item=f, total=total)
+        ui.progress(_('files'), i, item=f, total=total)
         try:
             linkrevs = filelinkrevs[f]
         except KeyError:
@@ -281,7 +281,7 @@
             fns = [(lr, n) for n, lr in filenodes[f].iteritems()]
             for lr, node in sorted(fns):
                 err(lr, _("%s in manifests not found") % short(node), f)
-    ui.progress('files', None)
+    ui.progress(_('files'), None)
 
     for f in storefiles:
         warn(_("warning: orphan revlog '%s'") % f)


More information about the Mercurial-devel mailing list