Patchwork D11483: manifestlog: also monitor `00manifestlog.n` when applicable

login
register
mail settings
Submitter phabricator
Date Sept. 21, 2021, 9:52 p.m.
Message ID <differential-rev-PHID-DREV-bh5lkfy7wu3xxewj4uwb-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49798/
State Superseded
Headers show

Comments

phabricator - Sept. 21, 2021, 9:52 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This let the locarepo's file cache detect outdated nodemap docket and reload the
  manifestlog after `localrepo.invalidate` when applicable.
  
  The same problem than issue6554 could affect the Manifest too.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -159,6 +159,21 @@ 
         return paths
 
 
+class manifestlogcache(storecache):
+    """filecache for the manifestlog"""
+
+    def __init__(self):
+        super(manifestlogcache, self).__init__()
+        _cachedfiles.add((b'00manifestlog.i', b''))
+        _cachedfiles.add((b'00manifestlog.n', b''))
+
+    def tracked_paths(self, obj):
+        paths = [self.join(obj, b'00manifestlog.i')]
+        if obj.store.opener.options.get(b'persistent-nodemap', False):
+            paths.append(self.join(obj, b'00manifestlog.n'))
+        return paths
+
+
 class mixedrepostorecache(_basefilecache):
     """filecache for a mix files in .hg/store and outside"""
 
@@ -1697,7 +1712,7 @@ 
             concurrencychecker=revlogchecker.get_checker(repo.ui, b'changelog'),
         )
 
-    @storecache(b'00manifest.i')
+    @manifestlogcache()
     def manifestlog(self):
         return self.store.manifestlog(self, self._storenarrowmatch)