D2489: narrow: move checking for narrow requirement into _narrowmatch()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Mar 1 02:17:59 UTC 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGcb0449f3d9fc: narrow: move checking for narrow requirement into _narrowmatch() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2489?vs=6189&id=6222

REVISION DETAIL
  https://phab.mercurial-scm.org/D2489

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowcommands.py
  hgext/narrow/narrowrepo.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py
--- a/hgext/narrow/narrowrepo.py
+++ b/hgext/narrow/narrowrepo.py
@@ -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,9 +77,9 @@
 
         @localrepo.repofilecache(narrowspec.FILENAME)
         def _narrowmatch(self):
+            if changegroup.NARROW_REQUIREMENT not in self.requirements:
+                return matchmod.always(self.root, '')
             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?
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -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__)
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -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)



To: martinvonz, durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list