Patchwork D6719: branchmap: refresh all "heads" of the branchmap subsets

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2019, 1:10 a.m.
Message ID <differential-rev-PHID-DREV-opq2u3kmlgu7urp44p6d-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41161/
State New
Headers show

Comments

phabricator - Aug. 6, 2019, 1:10 a.m.
spectral created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The comment about 'served' refreshing all the others only applies when served is
  the head of the branchmap cache subsets. This was already no longer the case
  (and is presumably why served.hidden was added) but the comment was not
  adjusted. Currently, the "heads" of the branchmap cache subsets are the three
  specified here: visible, visible-hidden, served.hidden.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/utils/repoviewutil.py
  tests/test-blackbox.t
  tests/test-branch-change.t
  tests/test-branches.t
  tests/test-clone-uncompressed.t
  tests/test-clone.t
  tests/test-clonebundles.t
  tests/test-fncache.t
  tests/test-hardlinks.t
  tests/test-histedit-drop.t
  tests/test-http-proxy.t
  tests/test-http.t
  tests/test-inherit-mode.t
  tests/test-keyword.t
  tests/test-merge-no-file-change.t
  tests/test-newbranch.t
  tests/test-phases.t
  tests/test-rebase-conflicts.t
  tests/test-share.t
  tests/test-ssh.t
  tests/test-strip.t
  tests/test-treemanifest.t

CHANGE DETAILS




To: spectral, durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Aug. 6, 2019, 1:13 a.m.
spectral added a comment.
spectral added a reviewer: marmoute.


  Adding marmoute as explicit reviewer.

REPOSITORY
  rHG Mercurial

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

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

To: spectral, durin42, #hg-reviewers, marmoute
Cc: mercurial-devel
phabricator - Aug. 8, 2019, 4:47 p.m.
This revision now requires changes to proceed.
marmoute added a comment.
marmoute requested changes to this revision.


  It seems like we are not warming enought cache with the new scheme.

INLINE COMMENTS

> localrepo.py:2204
> +                    filt = 'visible'
> +                self.filtered(filt).branchmap()
>  

We are no longer warming `served` explicitly If `served` and `served.hidden` are different this will be an issue (since `served` is much more used than `served.hidden`.

I would also add a `XXX` to the comment about `visible-hidden` to encourage people to investigate. This said. The same apply, we would need to warm both `visible` and `visible.hidden` explciitly.

> repoviewutil.py:28
> +# constant, so we just hard-code it.
> +subsettableheads = frozenset({'visible-hidden', 'served.hidden'})

Oops, it seems like `visible-hidden` and `served.hidden` has inconsistent naming. Feel free to fix that along the way.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -820,7 +820,7 @@ 
   $ hg clone --config experimental.changegroup3=True --stream -U \
   >   http://localhost:$HGPORT stream-clone-fncachestore
   streaming all changes
-  22 files to transfer, * of data (glob)
+  23 files to transfer, * of data (glob)
   transferred * in * seconds (*) (glob)
   $ hg -R stream-clone-fncachestore verify
   checking changesets
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -860,7 +860,8 @@ 
   bundle2-output-part: "phase-heads" 24 bytes payload
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/6625a5168474-345bb43d-backup.hg
   updating the branch cache
-  invalid branchheads cache (served): tip differs
+  invalid branchheads cache (*): tip differs (glob)
+  invalid branchheads cache (*): tip differs (glob)
   $ hg log -G
   o  changeset:   2:5c51d8d6557d
   |  tag:         tip
diff --git a/tests/test-ssh.t b/tests/test-ssh.t
--- a/tests/test-ssh.t
+++ b/tests/test-ssh.t
@@ -60,8 +60,8 @@ 
 
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
   streaming all changes
-  8 files to transfer, 827 bytes of data
-  transferred 827 bytes in * seconds (*) (glob)
+  9 files to transfer, 971 bytes of data
+  transferred 971 bytes in * seconds (*) (glob)
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd local-stream
@@ -80,8 +80,8 @@ 
   $ hg -R local-stream book mybook
   $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
   streaming all changes
-  9 files to transfer, 870 bytes of data
-  transferred 870 bytes in * seconds (*) (glob)
+  10 files to transfer, 1014 bytes of data
+  transferred 1014 bytes in * seconds (*) (glob)
   updating to branch default
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd stream2
diff --git a/tests/test-share.t b/tests/test-share.t
--- a/tests/test-share.t
+++ b/tests/test-share.t
@@ -45,6 +45,7 @@ 
   manifestfulltextcache (reporevlogstore !)
   $ ls -1 ../repo1/.hg/cache
   branch2-served
+  branch2-visible
   rbc-names-v1
   rbc-revs-v1
   tags2-visible
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
@@ -323,8 +323,9 @@ 
   bundle2-input-part: total payload size 24
   bundle2-input-bundle: 2 parts total
   updating the branch cache
-  invalid branchheads cache (served): tip differs
-  invalid branchheads cache (served.hidden): tip differs
+  invalid branchheads cache (*): tip differs (glob)
+  invalid branchheads cache (*): tip differs (glob)
+  invalid branchheads cache (*): tip differs (glob)
   rebase completed
 
 Test minimization of merge conflicts
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -231,6 +231,7 @@ 
   $ ls ../push-dest/.hg/cache/branch2*
   ../push-dest/.hg/cache/branch2-base
   ../push-dest/.hg/cache/branch2-served
+  ../push-dest/.hg/cache/branch2-visible
   $ cat ../push-dest/.hg/cache/branch2-served
   6d6770faffce199f1fddd1cf87f6f026138cf061 6 465891ffab3c47a3c23792f7dc84156e19a90722
   b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e o default
diff --git a/tests/test-newbranch.t b/tests/test-newbranch.t
--- a/tests/test-newbranch.t
+++ b/tests/test-newbranch.t
@@ -141,6 +141,7 @@ 
   $ cp .hg/bc-invalid $branchcache
 
   $ hg --debug log -r foo
+  invalid branchheads cache (visible): tip differs
   changeset:   4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6
   branch:      foo
   tag:         tip
diff --git a/tests/test-merge-no-file-change.t b/tests/test-merge-no-file-change.t
--- a/tests/test-merge-no-file-change.t
+++ b/tests/test-merge-no-file-change.t
@@ -361,6 +361,7 @@ 
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg ci --debug -m merge
+  invalid branchheads cache (visible): tip differs
   reusing manifest from p1 (no file change)
   committing changelog
   updating the branch cache
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -642,6 +642,7 @@ 
 Commit and show expansion in original and copy
 
   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache (visible): tip differs
   committing files:
   c
    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
@@ -817,6 +818,7 @@ 
 Commit with multi-line message and custom expansion
 
   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache (visible): tip differs
   committing files:
   a
   committing manifest
@@ -982,6 +984,7 @@ 
   [255]
   $ cd x
   $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
+  invalid branchheads cache (visible): tip differs
   committing files:
   x/a
    x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
diff --git a/tests/test-inherit-mode.t b/tests/test-inherit-mode.t
--- a/tests/test-inherit-mode.t
+++ b/tests/test-inherit-mode.t
@@ -71,6 +71,7 @@ 
   00600 ./.hg/00changelog.i
   00770 ./.hg/cache/
   00660 ./.hg/cache/branch2-served
+  00660 ./.hg/cache/branch2-visible
   00660 ./.hg/cache/rbc-names-v1
   00660 ./.hg/cache/rbc-revs-v1
   00660 ./.hg/dirstate
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -29,7 +29,7 @@ 
 #if no-reposimplestore
   $ hg clone --stream http://localhost:$HGPORT/ copy 2>&1
   streaming all changes
-  9 files to transfer, 715 bytes of data
+  10 files to transfer, 809 bytes of data
   transferred * bytes in * seconds (*/sec) (glob)
   updating to branch default
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -233,7 +233,7 @@ 
 #if no-reposimplestore
   $ hg clone http://user:pass@localhost:$HGPORT2/ dest 2>&1
   streaming all changes
-  10 files to transfer, 1.01 KB of data
+  11 files to transfer, 1.10 KB of data
   transferred * KB in * seconds (*/sec) (glob)
   updating to branch default
   5 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-http-proxy.t b/tests/test-http-proxy.t
--- a/tests/test-http-proxy.t
+++ b/tests/test-http-proxy.t
@@ -16,7 +16,7 @@ 
 
   $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --stream http://localhost:$HGPORT/ b
   streaming all changes
-  6 files to transfer, 412 bytes of data (reporevlogstore !)
+  7 files to transfer, 506 bytes of data (reporevlogstore !)
   4 files to transfer, 330 bytes of data (reposimplestore !)
   transferred * bytes in * seconds (*/sec) (glob)
   updating to branch default
diff --git a/tests/test-histedit-drop.t b/tests/test-histedit-drop.t
--- a/tests/test-histedit-drop.t
+++ b/tests/test-histedit-drop.t
@@ -92,6 +92,7 @@ 
 Check histedit_source
 
   $ hg log --debug --rev f518305ce889
+  invalid branchheads cache (visible): tip differs
   changeset:   4:f518305ce889c07cb5bd05522176d75590ef3324
   tag:         tip
   phase:       draft
diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t
--- a/tests/test-hardlinks.t
+++ b/tests/test-hardlinks.t
@@ -239,6 +239,7 @@ 
   2 r4/.hg/branch
   2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
+  2 r4/.hg/cache/branch2-visible
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   2 r4/.hg/dirstate
@@ -290,6 +291,7 @@ 
   1 r4/.hg/branch
   2 r4/.hg/cache/branch2-base
   2 r4/.hg/cache/branch2-served
+  2 r4/.hg/cache/branch2-visible
   2 r4/.hg/cache/rbc-names-v1
   2 r4/.hg/cache/rbc-revs-v1
   1 r4/.hg/dirstate
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -102,6 +102,7 @@ 
   .hg/00manifest.i
   .hg/cache
   .hg/cache/branch2-served
+  .hg/cache/branch2-visible
   .hg/cache/rbc-names-v1
   .hg/cache/rbc-revs-v1
   .hg/data
@@ -140,6 +141,7 @@ 
   .hg/00changelog.i
   .hg/cache
   .hg/cache/branch2-served
+  .hg/cache/branch2-visible
   .hg/cache/rbc-names-v1
   .hg/cache/rbc-revs-v1
   .hg/dirstate
diff --git a/tests/test-clonebundles.t b/tests/test-clonebundles.t
--- a/tests/test-clonebundles.t
+++ b/tests/test-clonebundles.t
@@ -467,8 +467,8 @@ 
   no compatible clone bundles available on server; falling back to regular clone
   (you may want to report this to the server operator)
   streaming all changes
-  9 files to transfer, 816 bytes of data
-  transferred 816 bytes in * seconds (*) (glob)
+  10 files to transfer, 910 bytes of data
+  transferred 910 bytes in * seconds (*) (glob)
 
 A manifest with a stream clone but no BUNDLESPEC
 
@@ -480,8 +480,8 @@ 
   no compatible clone bundles available on server; falling back to regular clone
   (you may want to report this to the server operator)
   streaming all changes
-  9 files to transfer, 816 bytes of data
-  transferred 816 bytes in * seconds (*) (glob)
+  10 files to transfer, 910 bytes of data
+  transferred 910 bytes in * seconds (*) (glob)
 
 A manifest with a gzip bundle and a stream clone
 
@@ -524,8 +524,8 @@ 
   no compatible clone bundles available on server; falling back to regular clone
   (you may want to report this to the server operator)
   streaming all changes
-  9 files to transfer, 816 bytes of data
-  transferred 816 bytes in * seconds (*) (glob)
+  10 files to transfer, 910 bytes of data
+  transferred 910 bytes in * seconds (*) (glob)
 
 Test clone bundle retrieved through bundle2
 
diff --git a/tests/test-clone.t b/tests/test-clone.t
--- a/tests/test-clone.t
+++ b/tests/test-clone.t
@@ -43,6 +43,7 @@ 
   default                       10:a7949464abda
   $ ls .hg/cache
   branch2-served
+  branch2-visible
   rbc-names-v1
   rbc-revs-v1
 
@@ -57,6 +58,7 @@ 
 
   $ ls .hg/cache
   branch2-served
+  branch2-visible
   rbc-names-v1
   rbc-revs-v1
 
@@ -128,6 +130,7 @@ 
 
   $ ls .hg/cache
   branch2-served
+  branch2-visible
   rbc-names-v1
   rbc-revs-v1
 
diff --git a/tests/test-clone-uncompressed.t b/tests/test-clone-uncompressed.t
--- a/tests/test-clone-uncompressed.t
+++ b/tests/test-clone-uncompressed.t
@@ -184,11 +184,12 @@ 
 #if stream-bundle2
   $ hg clone --stream -U http://localhost:$HGPORT clone1
   streaming all changes
-  1030 files to transfer, 96.5 KB of data
-  transferred 96.5 KB in * seconds (* */sec) (glob)
+  1031 files to transfer, 96.6 KB of data
+  transferred 96.6 KB in * seconds (* */sec) (glob)
 
   $ ls -1 clone1/.hg/cache
   branch2-served
+  branch2-visible
   rbc-names-v1
   rbc-revs-v1
 #endif
@@ -201,11 +202,11 @@ 
   
 
   $ f --size --hex --bytes 256 body
-  body: size=112262
+  body: size=112374
   0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......|
   0010: 7f 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |..STREAM2.......|
   0020: 05 09 04 0c 44 62 79 74 65 63 6f 75 6e 74 39 38 |....Dbytecount98|
-  0030: 37 37 35 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |775filecount1030|
+  0030: 38 36 39 66 69 6c 65 63 6f 75 6e 74 31 30 33 31 |869filecount1031|
   0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote|
   0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%|
   0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2|
@@ -232,8 +233,8 @@ 
 #if stream-bundle2
   $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed
   streaming all changes
-  1030 files to transfer, 96.5 KB of data
-  transferred 96.5 KB in * seconds (* */sec) (glob)
+  1031 files to transfer, 96.6 KB of data
+  transferred 96.6 KB in * seconds (* */sec) (glob)
 #endif
 
 Clone with background file closing enabled
@@ -274,12 +275,12 @@ 
   bundle2-input-bundle: with-transaction
   bundle2-input-part: "stream2" (params: 3 mandatory) supported
   applying stream bundle
-  1030 files to transfer, 96.5 KB of data
+  1031 files to transfer, 96.6 KB of data
   starting 4 threads for background file closing
   starting 4 threads for background file closing
   updating the branch cache
-  transferred 96.5 KB in * seconds (* */sec) (glob)
-  bundle2-input-part: total payload size 112094
+  transferred 96.6 KB in * seconds (* */sec) (glob)
+  bundle2-input-part: total payload size 112206
   bundle2-input-part: "listkeys" (params: 1 mandatory) supported
   bundle2-input-bundle: 1 parts total
   checking for updated bookmarks
@@ -318,8 +319,8 @@ 
 #if stream-bundle2
   $ hg clone --stream -U http://localhost:$HGPORT secret-allowed
   streaming all changes
-  1030 files to transfer, 96.5 KB of data
-  transferred 96.5 KB in * seconds (* */sec) (glob)
+  1031 files to transfer, 96.6 KB of data
+  transferred 96.6 KB in * seconds (* */sec) (glob)
 #endif
 
   $ killdaemons.py
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -867,6 +867,7 @@ 
 cache is rebuilt when corruption is detected
   $ echo > .hg/cache/rbc-names-v1
   $ hg log -r '5:&branch(.)' -T '{rev} ' --debug
+  invalid branchheads cache (visible): tip differs
   referenced branch names not found - rebuilding revision branch cache from scratch
   8 9 10 11 12 13 truncating cache/rbc-revs-v1 to 40
   $ f --size --hexdump .hg/cache/rbc-*
diff --git a/tests/test-branch-change.t b/tests/test-branch-change.t
--- a/tests/test-branch-change.t
+++ b/tests/test-branch-change.t
@@ -181,7 +181,8 @@ 
   starting 4 threads for background file closing (?)
   changed branch on 2 changesets
   updating the branch cache
-  invalid branchheads cache (served): tip differs
+  invalid branchheads cache (*): tip differs (glob)
+  invalid branchheads cache (*): tip differs (glob)
 
   $ hg glog -r '(.^)::'
   @  9:de1404b45a69 Added e
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -123,13 +123,15 @@ 
   added 1 changesets with 1 changes to 1 files
   new changesets d02f48003e62
   (run 'hg update' to get a working copy)
-  $ hg blackbox -l 6
+  $ hg blackbox -l 8
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull
-  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated served branch cache in * seconds (glob)
-  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote served branch cache with 1 labels and 2 nodes
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated * branch cache in * seconds (glob)
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote * branch cache with 1 labels and 2 nodes (glob)
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated * branch cache in * seconds (glob)
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote * branch cache with 1 labels and 2 nodes (glob)
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> 1 incoming changes - new heads: d02f48003e62
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> pull exited 0 after * seconds (glob)
-  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 8
 
 we must not cause a failure if we cannot write to the log
 
@@ -302,9 +304,9 @@ 
   
   result: 0
   $ hg blackbox
-  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updating the branch cache
-  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated served branch cache in * seconds (glob)
-  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote served branch cache with 1 labels and 1 nodes
+  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote * branch cache with 1 labels and 1 nodes (glob)
+  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> updated * branch cache in * seconds (glob)
+  1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> wrote * branch cache with 1 labels and 1 nodes (glob)
   1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug commit -m commit2 -d 2000-01-02 foo exited 0 after *.?? seconds (glob)
   1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> --debug log -r 0
   1970/01/01 00:00:00 bob @45589e459b2edfbf3dbde7e01f611d2c1e7453d7 (5000)> writing .hg/cache/tags2-visible with 0 tags
diff --git a/mercurial/utils/repoviewutil.py b/mercurial/utils/repoviewutil.py
--- a/mercurial/utils/repoviewutil.py
+++ b/mercurial/utils/repoviewutil.py
@@ -20,3 +20,9 @@ 
                'served.hidden': 'served',
                'served': 'immutable',
                'immutable': 'base'}
+
+# List of "heads" from `subsettable`: filters that do not have any superset that
+# would cause them to be populated, so they must be populated explicitly. This
+# can be calculated from `subsettable` but `subsettable` is essentially
+# constant, so we just hard-code it.
+subsettableheads = frozenset({'visible-hidden', 'served.hidden'})
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -69,6 +69,7 @@ 
 from .utils import (
     interfaceutil,
     procutil,
+    repoviewutil,
     stringutil,
 )
 
@@ -2179,7 +2180,7 @@ 
     def updatecaches(self, tr=None, full=False):
         """warm appropriate caches
 
-        If this function is called after a transaction closed. The transaction
+        If this function is called after a transaction closed, the transaction
         will be available in the 'tr' argument. This can be used to selectively
         update caches relevant to the changes in that transaction.
 
@@ -2192,10 +2193,15 @@ 
             return
 
         if tr is None or tr.changes['origrepolen'] < len(self):
-            # accessing the 'ser ved' branchmap should refresh all the others,
+            # Updating all of the "heads" of the cache hierarchy should cause
+            # all others that are stale to be updated.
             self.ui.debug('updating the branch cache\n')
-            self.filtered('served').branchmap()
-            self.filtered('served.hidden').branchmap()
+            for filt in repoviewutil.subsettableheads:
+                # Refreshing visible-hidden caused a lot of test failures, so
+                # we'll only do 'visible' for now.
+                if filt == 'visible-hidden':
+                    filt = 'visible'
+                self.filtered(filt).branchmap()
 
         if full:
             unfi = self.unfiltered()