comparison mercurial/localrepo.py @ 51493:79a7616a82b8

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 10 Mar 2024 03:29:12 +0100
parents 94f821490645
children 0239ebdd0740
comparison
equal deleted inserted replaced
51492:0c684ca692a4 51493:79a7616a82b8
2921 if caches is None: 2921 if caches is None:
2922 caches = repository.CACHES_DEFAULT 2922 caches = repository.CACHES_DEFAULT
2923 2923
2924 if repository.CACHE_BRANCHMAP_SERVED in caches: 2924 if repository.CACHE_BRANCHMAP_SERVED in caches:
2925 if tr is None or tr.changes[b'origrepolen'] < len(self): 2925 if tr is None or tr.changes[b'origrepolen'] < len(self):
2926 # accessing the 'served' branchmap should refresh all the others,
2927 self.ui.debug(b'updating the branch cache\n') 2926 self.ui.debug(b'updating the branch cache\n')
2928 self.filtered(b'served').branchmap() 2927 self._branchcaches.update_disk(self.filtered(b'served'))
2929 self.filtered(b'served.hidden').branchmap() 2928 self._branchcaches.update_disk(self.filtered(b'served.hidden'))
2930 2929
2931 if repository.CACHE_CHANGELOG_CACHE in caches: 2930 if repository.CACHE_CHANGELOG_CACHE in caches:
2932 self.changelog.update_caches(transaction=tr) 2931 self.changelog.update_caches(transaction=tr)
2933 2932
2934 if repository.CACHE_MANIFESTLOG_CACHE in caches: 2933 if repository.CACHE_MANIFESTLOG_CACHE in caches: