Mercurial > hg
changeset 50127:ec769cbc1fa2
dirstate: directly manage the dirstate property on localrepo
Before we had:
* the filecache layer on `localrepo` doing some caching
* the dirstate having some internal invalidation/refresh machanism
* the status code doing some identity validation.
To clean this up, we are dropping the first item "localrepo `filecache`" from
the equation in a favor of an approach integrated into the dirstate (second
item) in the next changesets.
This changeset will be a small windows where some things will be a bit slower.
This will be fixed in the next changesets.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Feb 2023 01:04:55 +0100 |
parents | 85746485a4dd |
children | 2f60cd6442fd |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Feb 21 15:10:12 2023 +0100 +++ b/mercurial/localrepo.py Wed Feb 22 01:04:55 2023 +0100 @@ -1750,8 +1750,10 @@ def manifestlog(self): return self.store.manifestlog(self, self._storenarrowmatch) - @repofilecache(b'dirstate') + @unfilteredpropertycache def dirstate(self): + # XXX This is known to be missing smarter caching. Check the next + # changesets return self._makedirstate() def _makedirstate(self): @@ -2965,13 +2967,9 @@ rereads the dirstate. Use dirstate.invalidate() if you want to explicitly read the dirstate again (i.e. restoring it to a previous known good state).""" - if hasunfilteredcache(self, 'dirstate'): - for k in self.dirstate._filecache: - try: - delattr(self.dirstate, k) - except AttributeError: - pass - delattr(self.unfiltered(), 'dirstate') + unfi = self.unfiltered() + if 'dirstate' in unfi.__dict__: + del unfi.__dict__['dirstate'] def invalidate(self, clearfilecache=False): """Invalidates both store and non-store parts other than dirstate @@ -2983,9 +2981,6 @@ """ unfiltered = self.unfiltered() # all file caches are stored unfiltered for k in list(self._filecache.keys()): - # dirstate is invalidated separately in invalidatedirstate() - if k == b'dirstate': - continue if ( k == b'changelog' and self.currenttransaction() @@ -3124,7 +3119,9 @@ self.ui.develwarn(msg) self.dirstate.write(None) - self._filecache[b'dirstate'].refresh() + unfi = self.unfiltered() + if 'dirstate' in unfi.__dict__: + del unfi.__dict__['dirstate'] l = self._lock( self.vfs,