mercurial/store.py
changeset 17745 b9a56b816ff2
parent 17744 09d5b2055295
child 17747 aad3bce98f76
--- a/mercurial/store.py	Thu Sep 13 17:00:34 2012 -0700
+++ b/mercurial/store.py	Thu Sep 13 17:57:43 2012 -0700
@@ -425,10 +425,19 @@
             self._dirty = True
             self.entries.add(fn)
 
-    def __contains__(self, fn):
+    def __contains__(self, path):
         if self.entries is None:
             self._load()
-        return fn in self.entries
+        # Check for files (exact match)
+        if path + ".i" in self.entries:
+            return True
+        # Now check for directories (prefix match)
+        if not path.endswith('/'):
+            path += '/'
+        for e in self.entries:
+            if e.startswith(path):
+                return True
+        return False
 
     def __iter__(self):
         if self.entries is None:
@@ -511,6 +520,11 @@
     def write(self):
         self.fncache.write()
 
+    def __contains__(self, path):
+        '''Checks if the store contains path'''
+        path = "/".join(("data", path))
+        return path in self.fncache
+
 def store(requirements, path, vfstype):
     if 'store' in requirements:
         if 'fncache' in requirements: