Patchwork [6,of,9] verify: extract "manifest" constant into variable

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 12, 2016, 10:40 p.m.
Message ID <CAESOdVDy92JoptLh-d+4EBADsbj7pxsbC0Qq9FHs_n1QRC4r-Q@mail.gmail.com>
Download mbox | patch
Permalink /patch/13160/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Feb. 12, 2016, 10:40 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1454543628 28800
#      Wed Feb 03 15:53:48 2016 -0800
# Node ID 9535b8d9a1d1c3e3b47661d8a046a41af3581046
# Parent  683fb192518dfed2824cec992f5e2ac5b224c27c
verify: extract "manifest" constant into variable

The "manifest" label that's used in error messages will instead be the
directory path for subdirectory manifests (not the root manifest), so
let's extract the constant to a variable already to make future
patches simpler.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -205,20 +205,20 @@ 
         ui.status(_("checking manifests\n"))
         filenodes = {}
         seen = {}
+        label = "manifest"
         if self.refersmf:
             # Do not check manifest if there are only changelog entries with
             # null manifests.
-            self.checklog(mf, "manifest", 0)
+            self.checklog(mf, label, 0)
         total = len(mf)
         for i in mf:
             ui.progress(_('checking'), i, total=total, unit=_('manifests'))
             n = mf.node(i)
-            lr = self.checkentry(mf, i, n, seen, mflinkrevs.get(n, []),
-                                 "manifest")
+            lr = self.checkentry(mf, i, n, seen, mflinkrevs.get(n, []), label)
             if n in mflinkrevs:
                 del mflinkrevs[n]
             else:
-                self.err(lr, _("%s not in changesets") % short(n), "manifest")
+                self.err(lr, _("%s not in changesets") % short(n), label)

             try:
                 for f, fn in mf.readdelta(n).iteritems():
@@ -229,14 +229,14 @@ 
                             filenodes.setdefault(
                                 _normpath(f), {}).setdefault(fn, lr)
             except Exception as inst:
-                self.exc(lr, _("reading delta %s") % short(n), inst,
"manifest")
+                self.exc(lr, _("reading delta %s") % short(n), inst, label)
         ui.progress(_('checking'), None)

         if self.havemf:
             for c, m in sorted([(c, m) for m in mflinkrevs
                         for c in mflinkrevs[m]]):
                 self.err(c, _("changeset refers to unknown revision %s") %
-                         short(m), "manifest")
+                         short(m), label)

         return filenodes