D3559: narrow: only wrap dirstate functions once, instead of per-reposetup
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Wed May 16 12:07:13 UTC 2018
yuja added a comment.
> -def setup(repo):
> +# Mapping of root:str to repo for repos that have the narrow requirement
> +# specified.
> +_rootrepomap = {}
> +
> +def _getrepo(ds):
> + """Check if narrow is enabled for repo associated with `ds`; return repo."""
> + return _rootrepomap.get(ds._root, None)
This might cause problem on long-running processes such as hgweb and
commandserver.
Instead, maybe we can extract a factory function of repo.dirstate() so that
the narrowrepo can easily override it.
class localrepository(object):
@repofilecache('dirstate')
def dirstate(self):
return self._makedirstate()
...
class narrowrepository(repo.__class__):
def _makedirstate(self):
d = super(...)
return wrapdirstate(d)
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3559
To: spectral, durin42, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list