D3097: verify: allow suppressing warnings about extra files

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Fri Apr 6 21:20:37 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG76d2115cb817: verify: allow suppressing warnings about extra files (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3097?vs=7679&id=7823

REVISION DETAIL
  https://phab.mercurial-scm.org/D3097

AFFECTED FILES
  mercurial/verify.py
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -35,6 +35,7 @@
     pycompat,
     revlog,
     store,
+    verify,
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
@@ -656,9 +657,17 @@
 
     return simplestore(path, vfstype)
 
+def verifierinit(orig, self, *args, **kwargs):
+    orig(self, *args, **kwargs)
+
+    # We don't care that files in the store don't align with what is
+    # advertised. So suppress these warnings.
+    self.warnorphanstorefiles = False
+
 def extsetup(ui):
     localrepo.featuresetupfuncs.add(featuresetup)
 
     extensions.wrapfunction(localrepo, 'newreporequirements',
                             newreporequirements)
     extensions.wrapfunction(store, 'store', makestore)
+    extensions.wrapfunction(verify.verifier, '__init__', verifierinit)
diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -52,6 +52,7 @@
         self.fncachewarned = False
         # developer config: verify.skipflags
         self.skipflags = repo.ui.configint('verify', 'skipflags')
+        self.warnorphanstorefiles = True
 
     def warn(self, msg):
         self.ui.warn(msg + "\n")
@@ -294,8 +295,9 @@
 
         if not dir and subdirnodes:
             ui.progress(_('checking'), None)
-            for f in sorted(storefiles):
-                self.warn(_("warning: orphan data file '%s'") % f)
+            if self.warnorphanstorefiles:
+                for f in sorted(storefiles):
+                    self.warn(_("warning: orphan data file '%s'") % f)
 
         return filenodes
 
@@ -369,8 +371,10 @@
                 try:
                     storefiles.remove(ff)
                 except KeyError:
-                    self.warn(_(" warning: revlog '%s' not in fncache!") % ff)
-                    self.fncachewarned = True
+                    if self.warnorphanstorefiles:
+                        self.warn(_(" warning: revlog '%s' not in fncache!") %
+                                  ff)
+                        self.fncachewarned = True
 
             self.checklog(fl, f, lr)
             seen = {}
@@ -481,7 +485,8 @@
                              short(node), f)
         ui.progress(_('checking'), None)
 
-        for f in sorted(storefiles):
-            self.warn(_("warning: orphan data file '%s'") % f)
+        if self.warnorphanstorefiles:
+            for f in sorted(storefiles):
+                self.warn(_("warning: orphan data file '%s'") % f)
 
         return len(files), revisions



To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list