mercurial/store.py
changeset 20883 cd443c7589cc
parent 20879 cd03854a2e06
child 20884 2efdd186925d
equal deleted inserted replaced
20882:5dffd06f1e50 20883:cd443c7589cc
   335             yield x
   335             yield x
   336 
   336 
   337     def copylist(self):
   337     def copylist(self):
   338         return ['requires'] + _data.split()
   338         return ['requires'] + _data.split()
   339 
   339 
   340     def write(self):
   340     def write(self, tr):
   341         pass
   341         pass
   342 
   342 
   343     def __contains__(self, path):
   343     def __contains__(self, path):
   344         '''Checks if the store contains path'''
   344         '''Checks if the store contains path'''
   345         path = "/".join(("data", path))
   345         path = "/".join(("data", path))
   400                 if not line.rstrip('\n'):
   400                 if not line.rstrip('\n'):
   401                     t = _('invalid entry in fncache, line %s') % (n + 1)
   401                     t = _('invalid entry in fncache, line %s') % (n + 1)
   402                     raise util.Abort(t)
   402                     raise util.Abort(t)
   403         fp.close()
   403         fp.close()
   404 
   404 
   405     def write(self):
   405     def write(self, tr):
   406         if self._dirty:
   406         if self._dirty:
       
   407             tr.addbackup('fncache')
   407             fp = self.vfs('fncache', mode='wb', atomictemp=True)
   408             fp = self.vfs('fncache', mode='wb', atomictemp=True)
   408             if self.entries:
   409             if self.entries:
   409                 fp.write(encodedir('\n'.join(self.entries) + '\n'))
   410                 fp.write(encodedir('\n'.join(self.entries) + '\n'))
   410             fp.close()
   411             fp.close()
   411             self._dirty = False
   412             self._dirty = False
   483         d = ('data dh fncache phaseroots obsstore'
   484         d = ('data dh fncache phaseroots obsstore'
   484              ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i')
   485              ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i')
   485         return (['requires', '00changelog.i'] +
   486         return (['requires', '00changelog.i'] +
   486                 ['store/' + f for f in d.split()])
   487                 ['store/' + f for f in d.split()])
   487 
   488 
   488     def write(self):
   489     def write(self, tr):
   489         self.fncache.write()
   490         self.fncache.write(tr)
   490 
   491 
   491     def _exists(self, f):
   492     def _exists(self, f):
   492         ef = self.encode(f)
   493         ef = self.encode(f)
   493         try:
   494         try:
   494             self.getsize(ef)
   495             self.getsize(ef)