branchcache: use update_disk to refresh 'served' and 'served.hidden'
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 10 Mar 2024 03:29:12 +0100
changeset 51557 79a7616a82b8
parent 51556 0c684ca692a4
child 51558 0239ebdd0740
branchcache: use update_disk to refresh 'served' and 'served.hidden' The `update_disk` method is dedicated to this kind of usecase. Now that the writting patterns are more consistent, we can use it to warm these two important cache. I am dropping the first comment about "refreshing all the others" because it is false. If a branchmap already exist for "served", none of the subset will be updated.
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sun Mar 10 03:25:04 2024 +0100
+++ b/mercurial/localrepo.py	Sun Mar 10 03:29:12 2024 +0100
@@ -2923,10 +2923,9 @@
 
         if repository.CACHE_BRANCHMAP_SERVED in caches:
             if tr is None or tr.changes[b'origrepolen'] < len(self):
-                # accessing the 'served' branchmap should refresh all the others,
                 self.ui.debug(b'updating the branch cache\n')
-                self.filtered(b'served').branchmap()
-                self.filtered(b'served.hidden').branchmap()
+                self._branchcaches.update_disk(self.filtered(b'served'))
+                self._branchcaches.update_disk(self.filtered(b'served.hidden'))
 
         if repository.CACHE_CHANGELOG_CACHE in caches:
             self.changelog.update_caches(transaction=tr)