1. mirror
  2. mercurial

Commits

Adrian Buehlmann  committed 8095306

store: move __contains__() implementation from class fncache into fncachestore

This restores the previous semantics of fncache.__contains__().

(a followup to b9a56b816ff2)

  • Participants
  • Parent commits 8ce5357
  • Branches default

Comments (0)

Files changed (1)

File mercurial/store.py

View file
             self._dirty = True
             self.entries.add(fn)
 
-    def __contains__(self, path):
+    def __contains__(self, fn):
         if self.entries is None:
             self._load()
-        # 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
+        return fn in self.entries
 
     def __iter__(self):
         if self.entries is None:
     def __contains__(self, path):
         '''Checks if the store contains path'''
         path = "/".join(("data", path))
-        return path in self.fncache
+        # check for files (exact match)
+        if path + '.i' in self.fncache:
+            return True
+        # now check for directories (prefix match)
+        if not path.endswith('/'):
+            path += '/'
+        for e in self.fncache:
+            if e.startswith(path):
+                return True
+        return False
 
 def store(requirements, path, vfstype):
     if 'store' in requirements: