Patchwork [3,of,6] verify: move fncachewarned up to a class variable

login
register
mail settings
Submitter Durham Goode
Date Dec. 19, 2015, 12:54 a.m.
Message ID <f8babc8c4fa71482f755.1450486456@dev8486.prn1.facebook.com>
Download mbox | patch
Permalink /patch/12175/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Durham Goode - Dec. 19, 2015, 12:54 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1450485759 28800
#      Fri Dec 18 16:42:39 2015 -0800
# Node ID f8babc8c4fa71482f755cec394cab9ca0c844c47
# Parent  0a65ac172df21e4cf0bc31bee016b08d0d0c79e3
verify: move fncachewarned up to a class variable

This makes is part of making verify more modular so hooks can extend it.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -58,6 +58,7 @@  class verifier(object):
         self.revlogv1 = repo.changelog.version != revlog.REVLOGV0
         self.lrugetctx = util.lrucachefunc(repo.changectx)
         self.refersmf = False
+        self.fncachewarned = False
 
     def verify(self):
         repo = self.repo
@@ -256,7 +257,6 @@  class verifier(object):
             elif size > 0 or not revlogv1:
                 storefiles.add(_normpath(f))
 
-        fncachewarned = False
         files = sorted(set(filenodes) | set(filelinkrevs))
         total = len(files)
         for i, f in enumerate(files):
@@ -283,7 +283,7 @@  class verifier(object):
                     storefiles.remove(ff)
                 except KeyError:
                     warn(_(" warning: revlog '%s' not in fncache!") % ff)
-                    fncachewarned = True
+                    self.fncachewarned = True
 
             checklog(fl, f, lr)
             seen = {}
@@ -353,7 +353,7 @@  class verifier(object):
                        (len(files), len(cl), revisions))
         if warnings[0]:
             ui.warn(_("%d warnings encountered!\n") % warnings[0])
-        if fncachewarned:
+        if self.fncachewarned:
             ui.warn(_('hint: run "hg debugrebuildfncache" to recover from '
                       'corrupt fncache\n'))
         if errors[0]: