##// END OF EJS Templates
store: add a contains method to fncachestore...
smuralid -
r17745:b9a56b81 default
parent child Browse files
Show More
@@ -425,10 +425,19 b' class fncache(object):'
425 self._dirty = True
425 self._dirty = True
426 self.entries.add(fn)
426 self.entries.add(fn)
427
427
428 def __contains__(self, fn):
428 def __contains__(self, path):
429 if self.entries is None:
429 if self.entries is None:
430 self._load()
430 self._load()
431 return fn in self.entries
431 # Check for files (exact match)
432 if path + ".i" in self.entries:
433 return True
434 # Now check for directories (prefix match)
435 if not path.endswith('/'):
436 path += '/'
437 for e in self.entries:
438 if e.startswith(path):
439 return True
440 return False
432
441
433 def __iter__(self):
442 def __iter__(self):
434 if self.entries is None:
443 if self.entries is None:
@@ -511,6 +520,11 b' class fncachestore(basicstore):'
511 def write(self):
520 def write(self):
512 self.fncache.write()
521 self.fncache.write()
513
522
523 def __contains__(self, path):
524 '''Checks if the store contains path'''
525 path = "/".join(("data", path))
526 return path in self.fncache
527
514 def store(requirements, path, vfstype):
528 def store(requirements, path, vfstype):
515 if 'store' in requirements:
529 if 'store' in requirements:
516 if 'fncache' in requirements:
530 if 'fncache' in requirements:
General Comments 0
You need to be logged in to leave comments. Login now