Patchwork D6710: branchmap: explicitly warm+write all subsets of the branchmap caches

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2019, 1:08 a.m.
Message ID <b1492d182e5527896f6b8c35a3d56428@localhost.localdomain>
Download mbox | patch
Permalink /patch/41160/
State Not Applicable
Headers show

Comments

phabricator - Aug. 6, 2019, 1:08 a.m.
spectral edited the summary of this revision.
spectral retitled this revision from "branchmap: properly refresh/warm all branchmap caches" to "branchmap: explicitly warm+write all subsets of the branchmap caches".
spectral marked an inline comment as done.
spectral updated this revision to Diff 16129.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6710?vs=16115&id=16129

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6710/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-debugcommands.t
  tests/test-server-view.t

CHANGE DETAILS




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

Patch

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 @@ 
   $ 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
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 @@ 
   .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/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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):