# HG changeset patch # User Kyle Lippincott # Date 2019-08-05 20:31:12 # Node ID cdf0e9523de12a98b9395192b7a25108a7d0b36d # Parent 53c07f08fea157e5f2cbd1fb8e7dda52c3a2dc42 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 diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2220,6 +2220,16 @@ class localrepository(object): 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): diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -546,7 +546,12 @@ Test cache warming command .hg/cache/rbc-revs-v1 .hg/cache/rbc-names-v1 .hg/cache/hgtagsfnodes1 + .hg/cache/branch2-visible-hidden + .hg/cache/branch2-visible + .hg/cache/branch2-served.hidden .hg/cache/branch2-served + .hg/cache/branch2-immutable + .hg/cache/branch2-base Test debugcolor diff --git a/tests/test-server-view.t b/tests/test-server-view.t --- a/tests/test-server-view.t +++ b/tests/test-server-view.t @@ -50,7 +50,12 @@ Check same result using `experimental.ex $ hg -R test --config experimental.extra-filter-revs='not public()' debugupdatecache $ ls -1 test/.hg/cache/ branch2-base%89c45d2fa07e + branch2-immutable%89c45d2fa07e branch2-served + branch2-served%89c45d2fa07e + branch2-served.hidden%89c45d2fa07e + branch2-visible%89c45d2fa07e + branch2-visible-hidden%89c45d2fa07e hgtagsfnodes1 rbc-names-v1 rbc-revs-v1