# HG changeset patch # User Martin von Zweigbergk # Date 2018-02-28 20:55:05 # Node ID 6aae869763246c69a1bfacc45cf0b757194cab00 # Parent 2d82a24d0c784700baf913eaec1314441626a471 narrow: always wrap repo It's simpler to always wrap the repo. This prepares for moving narrowrepo.narrowmatch() onto localrepo by showing that it's now safe to always wrap the repo (and thus always define narrowmatch() etc.). Note that since narrowmatch() returns an always-matcher (rather than None) in non-narrow repos, this may mean a performance hit when the narrow extension is enabled because it adds a no-op filtering step in various places against the always-matcher. I'll restore some of that soon. Differential Revision: https://phab.mercurial-scm.org/D2491 diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -72,8 +72,8 @@ def reposetup(ui, repo): if not isinstance(repo, localrepo.localrepository): return + narrowrepo.wraprepo(repo) if changegroup.NARROW_REQUIREMENT in repo.requirements: - narrowrepo.wraprepo(repo) narrowcopies.setup(repo) narrowdirstate.setup(repo) narrowpatch.setup(repo) diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -30,7 +30,6 @@ from mercurial import ( from . import ( narrowbundle2, - narrowrepo, ) table = {} @@ -101,10 +100,6 @@ def clonenarrowcmd(orig, ui, repo, *args '_pullbundle2extraprepare', pullbundle2extraprepare_widen) def pullnarrow(orig, repo, *args, **kwargs): - narrowrepo.wraprepo(repo.unfiltered()) - if isinstance(repo, repoview.repoview): - repo.__class__.__bases__ = (repo.__class__.__bases__[0], - repo.unfiltered().__class__) if opts_narrow: repo.requirements.add(changegroup.NARROW_REQUIREMENT) repo._writerequirements()