diff mercurial/store.py @ 20885:f49d60fa40a5

fncache: clean up fncache during strips Previously the fncache was cleaned up at read time by noticing when it was out of sync. This caused writes to happen outside the scope of transactions and could have caused race conditions. With this change, we'll keep the fncache up-to-date as we go by removing old entries during repair.strip.
author Durham Goode <durham@fb.com>
date Mon, 24 Mar 2014 15:43:15 -0700
parents 2efdd186925d
children afe0b48ef2d7
line wrap: on
line diff
--- a/mercurial/store.py	Mon Mar 24 15:35:07 2014 -0700
+++ b/mercurial/store.py	Mon Mar 24 15:43:15 2014 -0700
@@ -343,6 +343,9 @@
     def invalidatecaches(self):
         pass
 
+    def markremoved(self, fn):
+        pass
+
     def __contains__(self, path):
         '''Checks if the store contains path'''
         path = "/".join(("data", path))
@@ -421,6 +424,15 @@
             self._dirty = True
             self.entries.add(fn)
 
+    def remove(self, fn):
+        if self.entries is None:
+            self._load()
+        try:
+            self.entries.remove(fn)
+            self._dirty = True
+        except KeyError:
+            pass
+
     def __contains__(self, fn):
         if self.entries is None:
             self._load()
@@ -495,6 +507,9 @@
     def invalidatecaches(self):
         self.fncache.entries = None
 
+    def markremoved(self, fn):
+        self.fncache.remove(fn)
+
     def _exists(self, f):
         ef = self.encode(f)
         try: