comparison mercurial/localrepo.py @ 29924:e35a83cedde1

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.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 12 Sep 2016 03:06:29 +0900
parents d9c49138ab93
children 6b5a9a01f29d
comparison
equal deleted inserted replaced
29923:519a02267f90 29924:e35a83cedde1
1277 subsequent operation to reread any outside changes.''' 1277 subsequent operation to reread any outside changes.'''
1278 # extension should hook this to invalidate its caches 1278 # extension should hook this to invalidate its caches
1279 self.invalidate() 1279 self.invalidate()
1280 self.invalidatedirstate() 1280 self.invalidatedirstate()
1281 1281
1282 @unfilteredmethod
1282 def _refreshfilecachestats(self, tr): 1283 def _refreshfilecachestats(self, tr):
1283 """Reload stats of cached files so that they are flagged as valid""" 1284 """Reload stats of cached files so that they are flagged as valid"""
1284 for k, ce in self._filecache.items(): 1285 for k, ce in self._filecache.items():
1285 if k == 'dirstate' or k not in self.__dict__: 1286 if k == 'dirstate' or k not in self.__dict__:
1286 continue 1287 continue