fsmonitor: do not nuke dirstate filecache
In the future, chg may prefill repo's dirstate filecache so it's valuable
and should be kept. Previously we drop both filecache and property cache for
dirstate during fsmonitor reposetup, this patch changes it to only drop
property cache but keep the filecache.
--- a/hgext/fsmonitor/__init__.py Sat May 06 11:01:02 2017 -0700
+++ b/hgext/fsmonitor/__init__.py Sat May 06 16:36:24 2017 -0700
@@ -692,11 +692,13 @@
# at this point since fsmonitorstate wasn't present, repo.dirstate is
# not a fsmonitordirstate
- repo.dirstate.__class__ = makedirstate(repo.dirstate.__class__)
- # nuke the dirstate so that _fsmonitorinit and subsequent configuration
- # changes take effect on it
- del repo._filecache['dirstate']
- delattr(repo.unfiltered(), 'dirstate')
+ dirstate = repo.dirstate
+ dirstate.__class__ = makedirstate(dirstate.__class__)
+ dirstate._fsmonitorinit(fsmonitorstate, client)
+ # invalidate property cache, but keep filecache which contains the
+ # wrapped dirstate object
+ del repo.unfiltered().__dict__['dirstate']
+ assert dirstate is repo._filecache['dirstate'].obj
class fsmonitorrepo(repo.__class__):
def status(self, *args, **kwargs):