Mercurial > hg
changeset 33385:8bb4c69c4000
fsmonitor: avoid needless instantiation of dirstate
Using repo.local() instead of util.safehasattr(repo, 'dirstate') also
avoids executing setup procedures for remote repository (including
statichttprepo).
This is reason why this patch also removes a part of subsequent
comment, and try/except for AttributeError at accessing to repo.wvfs.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 10 Jul 2017 23:09:52 +0900 |
parents | bc1f373cf3f6 |
children | 5a9b4370bb3b |
files | hgext/fsmonitor/__init__.py |
diffstat | 1 files changed, 6 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py Mon Jul 10 23:09:51 2017 +0900 +++ b/hgext/fsmonitor/__init__.py Mon Jul 10 23:09:52 2017 +0900 @@ -677,16 +677,12 @@ 'extension and has been disabled.\n') % ext) return - if util.safehasattr(repo, 'dirstate'): - # We don't work with subrepos either. Note that we can get passed in - # e.g. a statichttprepo, which throws on trying to access the substate. - # XXX This sucks. - try: - # if repo[None].substate can cause a dirstate parse, which is too - # slow. Instead, look for a file called hgsubstate, - if repo.wvfs.exists('.hgsubstate') or repo.wvfs.exists('.hgsub'): - return - except AttributeError: + if repo.local(): + # We don't work with subrepos either. + # + # if repo[None].substate can cause a dirstate parse, which is too + # slow. Instead, look for a file called hgsubstate, + if repo.wvfs.exists('.hgsubstate') or repo.wvfs.exists('.hgsub'): return fsmonitorstate = state.state(repo)