Patchwork D7950: verify: avoid spurious integrity warnings in verbose mode (issue6172)

login
register
mail settings
Submitter phabricator
Date Jan. 19, 2020, 12:37 a.m.
Message ID <differential-rev-PHID-DREV-acsyf5zkc6idxgobbaox-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44526/
State Superseded
Headers show

Comments

phabricator - Jan. 19, 2020, 12:37 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The issue seems to revolve around renames in filtered commits, and only occurred
  in verbose mode.  The problem occurs in the `# check renames` stage, around line
  
  577. Without using the unfiltered repo, this test would have printed:
  
    $ hg verify -v repository uses revlog format 1 checking changesets checking manifests crosschecking files in changesets and manifests checking files foo@25: checking rename of 71ec0570c325: filtered revision '25' foobar@26: checking rename of 1b549296015b: filtered revision '26' checked 28 changesets with 16 changes to 11 files 2 integrity errors encountered! (first damaged changeset appears to be 25) [1]

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/verify.py
  tests/test-unamend.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 20, 2020, 4:36 p.m.
pulkit added a comment.


  TBH it feels not correct that some code path of `hg verify` needs unfiltered repository and that too around renames. Reading tests, I first thought it's some bug in unamend and then checked the issue to realize it's a general problem.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7950/new/

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

To: mharbison72, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Jan. 20, 2020, 5:30 p.m.
mharbison72 added a comment.


  In D7950#116781 <https://phab.mercurial-scm.org/D7950#116781>, @pulkit wrote:
  
  > TBH it feels not correct that some code path of `hg verify` needs unfiltered repository and that too around renames. Reading tests, I first thought it's some bug in unamend and then checked the issue to realize it's a general problem.
  
  The `verify.verifier` class uses an unfiltered repo, which I assume is why sometimes it can stray off into filtered revisions.  FWIW, I've got a repo at work that also prints:
  
    subrepo '$subrepo' is hidden in revision $hash
  
  This doesn't purport to fix that (and I struggled coming up with a test repro a few years ago).  Just mentioning that there are other filtering problems around verify.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7950/new/

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

To: mharbison72, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

diff --git a/tests/test-unamend.t b/tests/test-unamend.t
--- a/tests/test-unamend.t
+++ b/tests/test-unamend.t
@@ -346,6 +346,14 @@ 
   $ hg mv c wat
   $ hg unamend
 
+  $ hg verify -v
+  repository uses revlog format 1
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  checked 28 changesets with 16 changes to 11 files
+
 Retained copies in new prdecessor commit
 
   $ hg exp --git
diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -54,7 +54,7 @@ 
         self.havecl = len(repo.changelog) > 0
         self.havemf = len(repo.manifestlog.getstorage(b'')) > 0
         self.revlogv1 = repo.changelog.version != revlog.REVLOGV0
-        self.lrugetctx = util.lrucachefunc(repo.__getitem__)
+        self.lrugetctx = util.lrucachefunc(repo.unfiltered().__getitem__)
         self.refersmf = False
         self.fncachewarned = False
         # developer config: verify.skipflags