changeset 48040:7970895a21cb stable

manifestlog: also monitor `00manifest.n` when applicable 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. Differential Revision: https://phab.mercurial-scm.org/D11483
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 21 Sep 2021 18:18:56 +0200
parents c094e829e848
children 37a41267d000 750920b18aaa
files mercurial/localrepo.py
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Sep 21 18:03:37 2021 +0200
+++ b/mercurial/localrepo.py	Tue Sep 21 18:18:56 2021 +0200
@@ -159,6 +159,21 @@
         return paths
 
 
+class manifestlogcache(storecache):
+    """filecache for the manifestlog"""
+
+    def __init__(self):
+        super(manifestlogcache, self).__init__()
+        _cachedfiles.add((b'00manifest.i', b''))
+        _cachedfiles.add((b'00manifest.n', b''))
+
+    def tracked_paths(self, obj):
+        paths = [self.join(obj, b'00manifest.i')]
+        if obj.store.opener.options.get(b'persistent-nodemap', False):
+            paths.append(self.join(obj, b'00manifest.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)