[PATCH] localrepo: actually invalidate dirstate on invalidatedirstate()

Mateusz Kwapich mitrandir at fb.com
Fri Aug 26 15:31:09 UTC 2016


# HG changeset patch
# User Mateusz Kwapich <mitrandir at fb.com>
# Date 1472225341 25200
#      Fri Aug 26 08:29:01 2016 -0700
# Node ID 430e8c2cc229e0fbed231370c36cc2a215ecb30e
# Parent  318e2b600b80e4ed3c6f37df46ec7544f60d4c0b
localrepo: actually invalidate dirstate on invalidatedirstate()

The old dirstate was still present in the filecache. It was invalidated only
because filecache did stat the file on the next access. This can lead to errors
in the case when file stat didn't change but the dirstate contents did change
(and we know about it and thats why we sometimes call dirstateinvalidate() to
refresh it).

After this patch we will also invalidate the filecache on dirstateinvalidate.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1243,6 +1243,7 @@ class localrepository(object):
                     delattr(self.dirstate, k)
                 except AttributeError:
                     pass
+            self._filecache.pop('dirstate', None)
             delattr(self.unfiltered(), 'dirstate')
 
     def invalidate(self, clearfilecache=False):


More information about the Mercurial-devel mailing list