comparison mercurial/localrepo.py @ 18309:cfeab932cff7

localrepo: don't refresh filecache entries that aren't in __dict__ We call invalidate to remove properties from __dict__ because they're possibly outdated and we'd like to check for a new version. Next time the property is accessed the filecache mechanism checks the current stat info with the one recorded at the last time the property was read, if they're different it recreates the property. Previously we refreshed the stat info on all properties in the filecache when the lock is released, including properties that are missing from __dict__. This is a problem because: l = repo.lock() repo.P # stat info S for P is recorded in _filecache <changes are made to repo.P indirectly, e.g. underlying file is replaced> # P's new stat info = S' l.release() # filecache refreshes, records S' as P's stat info At this point our filecache contains P with stat info S', but P's version is from S, which is outdated. The above happens during _rollback and strip. Currently we're wiping the filecache and forcing everything to reload from scratch which works but isn't the right solution.
author Idan Kamara <idankk86@gmail.com>
date Sun, 16 Dec 2012 23:13:02 +0200
parents 2502a15e033d
children 4499ba5ac35c
comparison
equal deleted inserted replaced
18308:4e27b06a0fd9 18309:cfeab932cff7
1013 def unlock(): 1013 def unlock():
1014 self.store.write() 1014 self.store.write()
1015 if hasunfilteredcache(self, '_phasecache'): 1015 if hasunfilteredcache(self, '_phasecache'):
1016 self._phasecache.write() 1016 self._phasecache.write()
1017 for k, ce in self._filecache.items(): 1017 for k, ce in self._filecache.items():
1018 if k == 'dirstate': 1018 if k == 'dirstate' or k not in self.__dict__:
1019 continue 1019 continue
1020 ce.refresh() 1020 ce.refresh()
1021 1021
1022 l = self._lock(self.sjoin("lock"), wait, unlock, 1022 l = self._lock(self.sjoin("lock"), wait, unlock,
1023 self.invalidate, _('repository %s') % self.origroot) 1023 self.invalidate, _('repository %s') % self.origroot)