hgext/fsmonitor/__init__.py
changeset 32226 bf3af0eced44
parent 31846 1064a296a2a7
child 32321 7df259077d4b
--- 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):