Patchwork [2,of,2] store: assert the fncache have been loaded if dirty

login
register
mail settings
Submitter Boris Feld
Date July 16, 2018, 7:27 a.m.
Message ID <23df6fc7289615078ea3.1531726061@FB-lair>
Download mbox | patch
Permalink /patch/32852/
State Accepted
Headers show

Comments

Boris Feld - July 16, 2018, 7:27 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1531527043 -7200
#      Sat Jul 14 02:10:43 2018 +0200
# Node ID 23df6fc7289615078ea30e796d8ccb906a194eea
# Parent  fa319c92bed5fc495d62122697ee32a8fe2be8c4
# EXP-Topic perffncachewrite
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 23df6fc72896
store: assert the fncache have been loaded if dirty

This should catch fncache corruption as the one that existed in
`perffncachewrite`.

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -449,6 +449,7 @@  class fncache(object):
 
     def write(self, tr):
         if self._dirty:
+            assert self.entries is not None
             tr.addbackup('fncache')
             fp = self.vfs('fncache', mode='wb', atomictemp=True)
             if self.entries: