caches: invalidate store caches when lock is taken
authorDurham Goode <durham@fb.com>
Mon, 24 Mar 2014 15:35:07 -0700
changeset 20884 2efdd186925d
parent 20883 cd443c7589cc
child 20885 f49d60fa40a5
caches: invalidate store caches when lock is taken The fncache was not being properly invalidated each time the lock was taken, so in theory it could contain old data from prior to the caller having the lock. This changes it to be invalidated as soon as the lock is taken (same as all our other caches).
mercurial/localrepo.py
mercurial/store.py
--- a/mercurial/localrepo.py	Mon Mar 24 15:42:13 2014 -0700
+++ b/mercurial/localrepo.py	Mon Mar 24 15:35:07 2014 -0700
@@ -996,6 +996,7 @@
             except AttributeError:
                 pass
         self.invalidatecaches()
+        self.store.invalidatecaches()
 
     def invalidateall(self):
         '''Fully invalidates both store and non-store parts, causing the
--- a/mercurial/store.py	Mon Mar 24 15:42:13 2014 -0700
+++ b/mercurial/store.py	Mon Mar 24 15:35:07 2014 -0700
@@ -340,6 +340,9 @@
     def write(self, tr):
         pass
 
+    def invalidatecaches(self):
+        pass
+
     def __contains__(self, path):
         '''Checks if the store contains path'''
         path = "/".join(("data", path))
@@ -489,6 +492,9 @@
     def write(self, tr):
         self.fncache.write(tr)
 
+    def invalidatecaches(self):
+        self.fncache.entries = None
+
     def _exists(self, f):
         ef = self.encode(f)
         try: