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