dirstate.invalidate: avoid rebuilding _map
authorAlexis S. L. Carvalho <alexis@cecm.usp.br>
Thu, 19 Jul 2007 19:43:25 -0300
changeset 4953 6b3ed43f77ba
parent 4952 a11921d24ec4
child 4954 90be978c9d3d
child 4961 3fdd09ad6cce
dirstate.invalidate: avoid rebuilding _map Since hasattr will call __getattr__, the call to hasattr(self, '_dirs') will end up reparsing the dirstate file.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Thu Jul 19 19:43:25 2007 -0300
+++ b/mercurial/dirstate.py	Thu Jul 19 19:43:25 2007 -0300
@@ -164,8 +164,8 @@
 
     def invalidate(self):
         for a in "_map _copymap _branch _pl _dirs _ignore".split():
-            if hasattr(self, a):
-                self.__delattr__(a)
+            if a in self.__dict__:
+                delattr(self, a)
         self._dirty = 0
 
     def copy(self, source, dest):