dirstate: add filecache support stable
authorIdan Kamara <idankk86@gmail.com>
Thu, 01 Mar 2012 17:39:58 +0200
branchstable
changeset 16200 9d4a2942a732
parent 16199 8181bd808dc5
child 16201 fb7c4c14223f
dirstate: add filecache support
mercurial/dirstate.py
mercurial/localrepo.py
--- a/mercurial/dirstate.py	Thu Mar 01 17:39:58 2012 +0200
+++ b/mercurial/dirstate.py	Thu Mar 01 17:39:58 2012 +0200
@@ -52,6 +52,7 @@
         self._dirtypl = False
         self._lastnormaltime = 0
         self._ui = ui
+        self._filecache = {}
 
     @propertycache
     def _map(self):
--- a/mercurial/localrepo.py	Thu Mar 01 17:39:58 2012 +0200
+++ b/mercurial/localrepo.py	Thu Mar 01 17:39:58 2012 +0200
@@ -901,10 +901,13 @@
         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).'''
-        try:
+        if 'dirstate' in self.__dict__:
+            for k in self.dirstate._filecache:
+                try:
+                    delattr(self.dirstate, k)
+                except AttributeError:
+                    pass
             delattr(self, 'dirstate')
-        except AttributeError:
-            pass
 
     def invalidate(self):
         for k in self._filecache: