Patchwork [03,of,14,"] repoview: keep the branchmap cache for the `served.hidden` view warm

login
register
mail settings
Submitter Pierre-Yves David
Date April 13, 2019, 11:40 p.m.
Message ID <d5f42ea7b06825ee8662.1555198833@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39594/
State Accepted
Headers show

Comments

Pierre-Yves David - April 13, 2019, 11:40 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1554379129 -7200
#      Thu Apr 04 13:58:49 2019 +0200
# Node ID d5f42ea7b06825ee86620cdc18aaa3a53504bff5
# Parent  e34fc3aba6327af97f2bdf794497e89e7ef2a9ca
# EXP-Topic hgweb-obsolete
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r d5f42ea7b068
repoview: keep the branchmap cache for the `served.hidden` view warm

For the same reason we want to keep the cache for the `served` view up to date,
we want to also keep the `served.hidden` view up to date. If some processes with
a readonly access to the repo needs to access it, we better have the cache warm
to avoid computing the same data over and over and over.

In most case (no secret changesets), the "served" and "served.hidden" set will
be identical and no cache will actually have to be updated.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2107,6 +2107,7 @@  class localrepository(object):
             # accessing the 'ser ved' branchmap should refresh all the others,
             self.ui.debug('updating the branch cache\n')
             self.filtered('served').branchmap()
+            self.filtered('served.hidden').branchmap()
 
         if full:
             unfi = self.unfiltered()
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -330,6 +330,7 @@  Check that the right ancestors is used w
   bundle2-input-bundle: 2 parts total
   updating the branch cache
   invalid branchheads cache (served): tip differs
+  invalid branchheads cache (served.hidden): tip differs
   rebase completed
 
 Test minimization of merge conflicts
diff --git a/tests/test-remote-hidden.t b/tests/test-remote-hidden.t
--- a/tests/test-remote-hidden.t
+++ b/tests/test-remote-hidden.t
@@ -73,6 +73,20 @@  Testing the `served.hidden` view
 Test the feature
 ================
 
+Check cache pre-warm
+--------------------
+
+  $ ls -1 repo-with-hidden/.hg/cache
+  branch2
+  branch2-base
+  branch2-served
+  branch2-served.hidden
+  branch2-visible
+  rbc-names-v1
+  rbc-revs-v1
+  tags2
+  tags2-visible
+
 Check that the `served.hidden` repoview
 ---------------------------------------