Mercurial > hg-stable
changeset 51105:045b5f745f93
revlog: consolidate cache invalidation within the inner objet
The invalidation of data that belong to the inner object can and should be
delegated to the inner object.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 25 Oct 2023 23:14:20 +0200 |
parents | ae6722dbb575 |
children | 594f912818ab |
files | mercurial/revlog.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revlog.py Tue Oct 24 11:06:04 2023 +0200 +++ b/mercurial/revlog.py Wed Oct 25 23:14:20 2023 +0200 @@ -406,6 +406,11 @@ def __len__(self): return len(self.index) + def clear_cache(self): + self._revisioncache = None + self._segmentfile.clear_cache() + self._segmentfile_sidedata.clear_cache() + # Derived from index values. def start(self, rev): @@ -1807,10 +1812,8 @@ def clearcaches(self): """Clear in-memory caches""" - self._inner._revisioncache = None self._chainbasecache.clear() - self._inner._segmentfile.clear_cache() - self._inner._segmentfile_sidedata.clear_cache() + self._inner.clear_cache() self._pcache = {} self._nodemap_docket = None self.index.clearcaches() @@ -3502,10 +3505,8 @@ self._docket.write(transaction, stripping=True) # then reset internal state in memory to forget those revisions - self._inner._revisioncache = None self._chaininfocache = util.lrucachedict(500) - self._inner._segmentfile.clear_cache() - self._inner._segmentfile_sidedata.clear_cache() + self._inner.clear_cache() del self.index[rev:-1]