comparison mercurial/store.py @ 17783:df55ce6854c3

store: add new _exists helper function on fncachestore
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 12 Oct 2012 10:52:32 +0200
parents 8095306c1fb2
children 73e1ab39792c
comparison
equal deleted inserted replaced
17782:8095306c1fb2 17783:df55ce6854c3
510 ['store/' + f for f in d.split()]) 510 ['store/' + f for f in d.split()])
511 511
512 def write(self): 512 def write(self):
513 self.fncache.write() 513 self.fncache.write()
514 514
515 def _exists(self, f):
516 ef = self.encode(f)
517 try:
518 self.getsize(ef)
519 return True
520 except OSError, err:
521 if err.errno != errno.ENOENT:
522 raise
523 # nonexistent entry
524 return False
525
515 def __contains__(self, path): 526 def __contains__(self, path):
516 '''Checks if the store contains path''' 527 '''Checks if the store contains path'''
517 path = "/".join(("data", path)) 528 path = "/".join(("data", path))
518 # check for files (exact match) 529 # check for files (exact match)
519 if path + '.i' in self.fncache: 530 if path + '.i' in self.fncache: