Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 32226:bf3af0eced44
fsmonitor: do not nuke dirstate filecache
In the future, chg may prefill repo's dirstate filecache so it's valuable
and should be kept. Previously we drop both filecache and property cache for
dirstate during fsmonitor reposetup, this patch changes it to only drop
property cache but keep the filecache.
author | Jun Wu <quark@fb.com> |
---|---|
date | Sat, 06 May 2017 16:36:24 -0700 |
parents | 1064a296a2a7 |
children | 7df259077d4b |
comparison
equal
deleted
inserted
replaced
32225:c68c400d0a2d | 32226:bf3af0eced44 |
---|---|
690 repo._fsmonitorstate = fsmonitorstate | 690 repo._fsmonitorstate = fsmonitorstate |
691 repo._watchmanclient = client | 691 repo._watchmanclient = client |
692 | 692 |
693 # at this point since fsmonitorstate wasn't present, repo.dirstate is | 693 # at this point since fsmonitorstate wasn't present, repo.dirstate is |
694 # not a fsmonitordirstate | 694 # not a fsmonitordirstate |
695 repo.dirstate.__class__ = makedirstate(repo.dirstate.__class__) | 695 dirstate = repo.dirstate |
696 # nuke the dirstate so that _fsmonitorinit and subsequent configuration | 696 dirstate.__class__ = makedirstate(dirstate.__class__) |
697 # changes take effect on it | 697 dirstate._fsmonitorinit(fsmonitorstate, client) |
698 del repo._filecache['dirstate'] | 698 # invalidate property cache, but keep filecache which contains the |
699 delattr(repo.unfiltered(), 'dirstate') | 699 # wrapped dirstate object |
700 del repo.unfiltered().__dict__['dirstate'] | |
701 assert dirstate is repo._filecache['dirstate'].obj | |
700 | 702 |
701 class fsmonitorrepo(repo.__class__): | 703 class fsmonitorrepo(repo.__class__): |
702 def status(self, *args, **kwargs): | 704 def status(self, *args, **kwargs): |
703 orig = super(fsmonitorrepo, self).status | 705 orig = super(fsmonitorrepo, self).status |
704 return overridestatus(orig, self, *args, **kwargs) | 706 return overridestatus(orig, self, *args, **kwargs) |