Skip to content
Snippets Groups Projects
Commit a8b4d767 authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

narrow: move checking for narrow requirement into _narrowmatch()

We want to move narrowmatch() and others into core, so we need to get
rid of the dependence on the "narrow_opts" from the closure in
narrowrepo.wraprepo(). We can simply check if the narrow requirement
is set. I think that seems like an improvement regardless of moving
narrowmatch().

Differential Revision: https://phab.mercurial-scm.org/D2489
parent 94709406
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,7 @@
return
if changegroup.NARROW_REQUIREMENT in repo.requirements:
narrowrepo.wraprepo(repo, True)
narrowrepo.wraprepo(repo)
narrowcopies.setup(repo)
narrowdirstate.setup(repo)
narrowpatch.setup(repo)
......
......@@ -101,7 +101,7 @@
'_pullbundle2extraprepare', pullbundle2extraprepare_widen)
def pullnarrow(orig, repo, *args, **kwargs):
narrowrepo.wraprepo(repo.unfiltered(), opts_narrow)
narrowrepo.wraprepo(repo.unfiltered())
if isinstance(repo, repoview.repoview):
repo.__class__.__bases__ = (repo.__class__.__bases__[0],
repo.unfiltered().__class__)
......
......@@ -38,7 +38,7 @@
f.write(spec)
return orig(ui, repo, repopath)
def wraprepo(repo, opts_narrow):
def wraprepo(repo):
"""Enables narrow clone functionality on a single local repository."""
cacheprop = localrepo.storecache
......@@ -77,4 +77,6 @@
@localrepo.repofilecache(narrowspec.FILENAME)
def _narrowmatch(self):
if changegroup.NARROW_REQUIREMENT not in self.requirements:
return matchmod.always(self.root, '')
include, exclude = self.narrowpats
......@@ -80,6 +82,4 @@
include, exclude = self.narrowpats
if not opts_narrow and not include and not exclude:
return matchmod.always(self.root, '')
return narrowspec.match(self.root, include=include, exclude=exclude)
# TODO(martinvonz): make this property-like instead?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment