filecache: allow filecacheentry to be created without stating in __init__
Will be used for properties that are set without getting them first.
rollback: don't clear the filecache
This was an old workaround to force the filecache to reload everything. Now
that the syncing issue is fixed, we no longer need it.
destroyed: keep the filecache in sync with __dict__ (
issue3335) (
issue3693) (
issue3743)
We need to make sure that if X is in the filecache then it's also in the
filecache owner's __dict__, otherwise it will go out of sync:
repo.X # first access to X, records stat info in
# filecache and updates __dict__
repo._filecache.clear() # removes X from _filecache but it's still in __dict__
repo.invalidate() # iterates over _filecache and removes entries
# from __dict__, but X isn't in _filecache, so
# it's kept in __dict__
repo.X # X is fetched from __dict__, bypassing the filecache
localrepo: update the branchmap when destroying nodes
This was previously called directly during strip. Moving it to destroying
also means that it'll be called through _rollback, which seems harmless.
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.
changelog: please check-code and remove tabs
Tabs were introduced in
06185554e7e3.