##// 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 class fncache(object):
425 425 self._dirty = True
426 426 self.entries.add(fn)
427 427
428 def __contains__(self, fn):
428 def __contains__(self, path):
429 429 if self.entries is None:
430 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 442 def __iter__(self):
434 443 if self.entries is None:
@@ -511,6 +520,11 class fncachestore(basicstore):
511 520 def write(self):
512 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 528 def store(requirements, path, vfstype):
515 529 if 'store' in requirements:
516 530 if 'fncache' in requirements:
General Comments 0
You need to be logged in to leave comments. Login now