mercurial/store.py
changeset 17745 b9a56b816ff2
parent 17744 09d5b2055295
child 17747 aad3bce98f76
equal deleted inserted replaced
17744:09d5b2055295 17745:b9a56b816ff2
   423             self._load()
   423             self._load()
   424         if fn not in self.entries:
   424         if fn not in self.entries:
   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:
   435             self._load()
   444             self._load()
   436         return iter(self.entries)
   445         return iter(self.entries)
   509                 ['store/' + f for f in d.split()])
   518                 ['store/' + f for f in d.split()])
   510 
   519 
   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:
   517             return fncachestore(path, vfstype, 'dotencode' in requirements)
   531             return fncachestore(path, vfstype, 'dotencode' in requirements)
   518         return encodedstore(path, vfstype)
   532         return encodedstore(path, vfstype)