[PATCH 2 of 4] localrepo: factor out invalidation of @filecache properties to reuse
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Sep 2 14:34:11 EDT 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1472840248 -32400
# Sat Sep 03 03:17:28 2016 +0900
# Node ID 32f53aaf63f8db0c1352a3b0afb290c425486704
# Parent b9866cdaf302d52a7ddafa60a8a8e5155a764342
localrepo: factor out invalidation of @filecache properties to reuse
streamclone wants to clear @filecache properties just after directly
writing changes into files, to avoid inconsistency between in-memory
cached properties and streamclone-ed files on disk.
On the other hand, it doesn't want to clear fncache before closing
transaction, because in-memory changes of fncache should be written
out as a part of a transaction.
Therefore, invalidate() isn't suitable for such purpose.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1245,19 +1245,27 @@ class localrepository(object):
pass
delattr(self.unfiltered(), 'dirstate')
- def invalidate(self, clearfilecache=False):
+ def invalidatefilecaches(self, clearcache):
+ '''Invalidate @filecache properties except for dirstate
+
+ If clearcache is true, this completely discards already cached
+ properties.
+ '''
unfiltered = self.unfiltered() # all file caches are stored unfiltered
for k in self._filecache.keys():
# dirstate is invalidated separately in invalidatedirstate()
if k == 'dirstate':
continue
- if clearfilecache:
+ if clearcache:
del self._filecache[k]
try:
delattr(unfiltered, k)
except AttributeError:
pass
+
+ def invalidate(self, clearfilecache=False):
+ self.invalidatefilecaches(clearfilecache)
self.invalidatecaches()
self.store.invalidatecaches()
More information about the Mercurial-devel
mailing list