Mercurial > hg
comparison hgext/fsmonitor/__init__.py @ 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 | 377e8ddaebef |
comparison
equal
deleted
inserted
replaced
33386:5a9b4370bb3b | 33387:68e9762a357b |
---|---|
696 return | 696 return |
697 | 697 |
698 repo._fsmonitorstate = fsmonitorstate | 698 repo._fsmonitorstate = fsmonitorstate |
699 repo._watchmanclient = client | 699 repo._watchmanclient = client |
700 | 700 |
701 # at this point since fsmonitorstate wasn't present, repo.dirstate is | 701 dirstate, cached = localrepo.isfilecached(repo, 'dirstate') |
702 # not a fsmonitordirstate | 702 if cached: |
703 dirstate = repo.dirstate | 703 # at this point since fsmonitorstate wasn't present, |
704 makedirstate(repo, dirstate) | 704 # repo.dirstate is not a fsmonitordirstate |
705 | 705 makedirstate(repo, dirstate) |
706 # invalidate property cache, but keep filecache which contains the | |
707 # wrapped dirstate object | |
708 del repo.unfiltered().__dict__['dirstate'] | |
709 assert dirstate is repo._filecache['dirstate'].obj | |
710 | 706 |
711 class fsmonitorrepo(repo.__class__): | 707 class fsmonitorrepo(repo.__class__): |
712 def status(self, *args, **kwargs): | 708 def status(self, *args, **kwargs): |
713 orig = super(fsmonitorrepo, self).status | 709 orig = super(fsmonitorrepo, self).status |
714 return overridestatus(orig, self, *args, **kwargs) | 710 return overridestatus(orig, self, *args, **kwargs) |