changeset 50673:5d84b1385f7f

treemanifest: make `updatecaches` update the nodemaps for all directories Without this, if the cache for a nested directory is in a bad state, it's very hard to repair it.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 18 May 2023 19:23:59 +0100
parents 3b56395404a1
children b10c786b0145
files mercurial/localrepo.py tests/test-fncache.t tests/test-treemanifest.t
diffstat 3 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed May 31 10:37:55 2023 +0100
+++ b/mercurial/localrepo.py	Thu May 18 19:23:59 2023 +0100
@@ -2936,6 +2936,14 @@
 
         if repository.CACHE_MANIFESTLOG_CACHE in caches:
             self.manifestlog.update_caches(transaction=tr)
+            for entry in self.store.walk():
+                if not entry.is_revlog:
+                    continue
+                if not entry.is_manifestlog:
+                    continue
+                manifestrevlog = entry.get_revlog_instance(self).get_revlog()
+                if manifestrevlog is not None:
+                    manifestrevlog.update_caches(transaction=tr)
 
         if repository.CACHE_REV_BRANCH in caches:
             rbc = unfi.revbranchcache()
--- a/tests/test-fncache.t	Wed May 31 10:37:55 2023 +0100
+++ b/tests/test-fncache.t	Thu May 18 19:23:59 2023 +0100
@@ -514,6 +514,7 @@
   $ hg clone -q . tobundle
   fncache load triggered!
   fncache load triggered!
+  fncache load triggered!
 
   $ echo 'new line' > tobundle/bar
   $ hg -R tobundle ci -qm bar
--- a/tests/test-treemanifest.t	Wed May 31 10:37:55 2023 +0100
+++ b/tests/test-treemanifest.t	Thu May 18 19:23:59 2023 +0100
@@ -897,3 +897,8 @@
   .hg/store/meta/dir/00manifest.i: size=721
   $ hg files --rev tip | wc -l
   \s*20 (re)
+
+testing cache update warming persistent nodemaps
+------------------------------------------------
+
+  $ hg debugupdatecache