# HG changeset patch # User Pierre-Yves David # Date 1710037752 -3600 # Node ID 79a7616a82b8aa5f4a1a1241f483a9244d6be677 # Parent 0c684ca692a49bce0ad07cf9935a02807ac0fce6 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. diff -r 0c684ca692a4 -r 79a7616a82b8 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)