[PATCH 4 of 4] localrepo: make _refreshfilecachestats unfiltered method to refresh correctly
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Sep 2 14:34:13 EDT 2016
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1472840250 -32400
# Sat Sep 03 03:17:30 2016 +0900
# Node ID b4264bfd8cbc814cab2c87f4752a8b05f84f6f77
# Parent 33e29b5ebe885cdeeef433861e2d165b882d48d1
localrepo: make _refreshfilecachestats unfiltered method to refresh correctly
Before this patch, if transaction is started via "filtered repo"
object, _refreshfilecachestats() at closing transaction doesn't
refresh file stat of any @filecache properties correctly, because:
- _refreshfilecachestats() omits refreshing file stat of a
@filecache property, if it doesn't appear in self.__dict__
- if transaction is started via "filtered repo",
_refreshfilecachestats() is applied on "filtered repo"
because repo.transaction() adds "self._refreshfilecachestats" to
post close procedures. repo.transaction() isn't unfiltered method,
and "self" in it means "filtered repo" in this case.
Transactions started by explicit repo.transaction() easily causes
this situation.
- _refreshfilecachestats() applied on "filtered repo" omits whole
refreshing
because @filecache properties are stored into "unfiltered repo",
and appear only in self.__dict__ of "unfiltered repo".
This incorrect refreshing causes unnecessary reloading from files.
To refresh file stat of @filecache properties at closing transaction
correctly, this patch makes _refreshfilecachestats() unfiltered
method.
This patch chooses making _refreshfilecachestats() unfiltered method
instead of making transaction() unfiltered method, to reduce
unexpected side effect.
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1276,6 +1276,7 @@ class localrepository(object):
self.invalidate()
self.invalidatedirstate()
+ @unfilteredmethod
def _refreshfilecachestats(self, tr):
"""Reload stats of cached files so that they are flagged as valid"""
for k, ce in self._filecache.items():
More information about the Mercurial-devel
mailing list