diff mercurial/localrepo.py @ 42712:cdf0e9523de1

branchmap: explicitly warm+write all subsets of the branchmap caches 'full' claims it will warm all of the caches that are known about, but this was not the case - it did not actually warm the branchmap caches for subsets that we haven't requested, or for subsets that are still considered "valid". By explicitly writing them to disk, we can force the subsets for ex: "served" to be written ("immutable" and "base"), making it cheaper to calculate "served" the next time it needs to be updated. Differential Revision: https://phab.mercurial-scm.org/D6710
author Kyle Lippincott <spectral@google.com>
date Mon, 05 Aug 2019 13:31:12 -0700
parents 863e9e7f8850
children 268662aac075
line wrap: on
line diff
--- a/mercurial/localrepo.py	Wed Jun 12 13:42:52 2019 +0100
+++ b/mercurial/localrepo.py	Mon Aug 05 13:31:12 2019 -0700
@@ -2220,6 +2220,16 @@
             self.tags()
             self.filtered('served').tags()
 
+            # The `full` arg is documented as updating even the lazily-loaded
+            # caches immediately, so we're forcing a write to cause these caches
+            # to be warmed up even if they haven't explicitly been requested
+            # yet (if they've never been used by hg, they won't ever have been
+            # written, even if they're a subset of another kind of cache that
+            # *has* been used).
+            for filt in repoview.filtertable.keys():
+                filtered = self.filtered(filt)
+                filtered.branchmap().write(filtered)
+
     def invalidatecaches(self):
 
         if r'_tagscache' in vars(self):