[PATCH 3 of 5 STABLE] dirstate: add filecache support

Idan Kamara idankk86 at gmail.com
Thu Mar 1 15:55:40 UTC 2012


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1330616398 -7200
# Branch stable
# Node ID 9d4a2942a732ee2d8453d1fc4a81ae5683247762
# Parent  8181bd808dc56e25dd2e49057bec128a05faae45
dirstate: add filecache support

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -52,6 +52,7 @@
         self._dirtypl = False
         self._lastnormaltime = 0
         self._ui = ui
+        self._filecache = {}
 
     @propertycache
     def _map(self):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -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:



More information about the Mercurial-devel mailing list