diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2192,10 +2192,13 @@ return if tr is None or tr.changes['origrepolen'] < len(self): - # accessing the 'ser ved' branchmap should refresh all the others, + # There are three "heads" to the cache hierarchy: visible, + # visible-hidden, and served.hidden. Updating any of these three + # should cause all of the others (currently: served, immutable, + # base) 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 ['visible', 'visible-hidden', 'served.hidden']: + self.filtered(filt).branchmap() if full: unfi = self.unfiltered() @@ -2214,6 +2217,12 @@ self.tags() self.filtered('served').tags() + # Warm the branchmap caches even for caches we haven't needed yet, + # including forcing a write to disk. + for filt in repoview.filtertable.keys(): + filtered = self.filtered(filt) + filtered.branchmap().write(filtered) + def invalidatecaches(self): if r'_tagscache' in vars(self):