comparison mercurial/store.py @ 38696:89d93dd1a222

store: assert the fncache have been loaded if dirty This should catch fncache corruption as the one that existed in `perffncachewrite`.
author Boris Feld <boris.feld@octobus.net>
date Sat, 14 Jul 2018 02:10:43 +0200
parents 8ac0c9cd4c48
children e7aa113b14f7
comparison
equal deleted inserted replaced
38695:2cdb82e8fb44 38696:89d93dd1a222
447 raise error.Abort(t) 447 raise error.Abort(t)
448 fp.close() 448 fp.close()
449 449
450 def write(self, tr): 450 def write(self, tr):
451 if self._dirty: 451 if self._dirty:
452 assert self.entries is not None
452 tr.addbackup('fncache') 453 tr.addbackup('fncache')
453 fp = self.vfs('fncache', mode='wb', atomictemp=True) 454 fp = self.vfs('fncache', mode='wb', atomictemp=True)
454 if self.entries: 455 if self.entries:
455 fp.write(encodedir('\n'.join(self.entries) + '\n')) 456 fp.write(encodedir('\n'.join(self.entries) + '\n'))
456 fp.close() 457 fp.close()