Mercurial > hg
changeset 33387:68e9762a357b
fsmonitor: execute setup procedures only if dirstate is already instantiated
Before this patch, reposetup() of fsmonitor executes setup procedures
for dirstate, even if it isn't yet instantiated at that time.
On the other hand, dirstate might be already instantiated before
reposetup() intentionally (prefilling by chg, for example, see
bf3af0eced44 for detail). If so, just discarding already instantiated
one in reposetup() causes issue.
To resolve both issues above, this patch executes setup procedures,
only if dirstate is already instantiated.
BTW, this patch removes "del repo.unfiltered().__dict__['dirstate']",
because it is responsibility of the code path, which causes
instantiation of dirstate before reposetup(). After this patch, using
localrepo.isfilecached() should avoid creating the corresponded entry
in repo.unfiltered().__dict__.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 10 Jul 2017 23:09:52 +0900 |
parents | 5a9b4370bb3b |
children | 0823f0983eaa |
files | hgext/fsmonitor/__init__.py |
diffstat | 1 files changed, 5 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py Mon Jul 10 23:09:52 2017 +0900 +++ b/hgext/fsmonitor/__init__.py Mon Jul 10 23:09:52 2017 +0900 @@ -698,15 +698,11 @@ repo._fsmonitorstate = fsmonitorstate repo._watchmanclient = client - # at this point since fsmonitorstate wasn't present, repo.dirstate is - # not a fsmonitordirstate - dirstate = repo.dirstate - makedirstate(repo, dirstate) - - # invalidate property cache, but keep filecache which contains the - # wrapped dirstate object - del repo.unfiltered().__dict__['dirstate'] - assert dirstate is repo._filecache['dirstate'].obj + dirstate, cached = localrepo.isfilecached(repo, 'dirstate') + if cached: + # at this point since fsmonitorstate wasn't present, + # repo.dirstate is not a fsmonitordirstate + makedirstate(repo, dirstate) class fsmonitorrepo(repo.__class__): def status(self, *args, **kwargs):