# HG changeset patch # User Jun Wu # Date 1494113784 25200 # Node ID bf3af0eced4444d71a3d5666f8e1c252717fca97 # Parent c68c400d0a2d46e5758ae0894a741336547c3a95 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. diff -r c68c400d0a2d -r bf3af0eced44 hgext/fsmonitor/__init__.py --- 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):