hgext/narrow/narrowrepo.py
changeset 36466 a8b4d7673d8e
parent 36464 3f0af89e008d
child 36470 d851951b421c
equal deleted inserted replaced
36465:94709406f10d 36466:a8b4d7673d8e
    36             spec = f.read()
    36             spec = f.read()
    37         with repo.vfs(narrowspec.FILENAME, 'w') as f:
    37         with repo.vfs(narrowspec.FILENAME, 'w') as f:
    38             f.write(spec)
    38             f.write(spec)
    39     return orig(ui, repo, repopath)
    39     return orig(ui, repo, repopath)
    40 
    40 
    41 def wraprepo(repo, opts_narrow):
    41 def wraprepo(repo):
    42     """Enables narrow clone functionality on a single local repository."""
    42     """Enables narrow clone functionality on a single local repository."""
    43 
    43 
    44     cacheprop = localrepo.storecache
    44     cacheprop = localrepo.storecache
    45     if isinstance(repo, bundlerepo.bundlerepository):
    45     if isinstance(repo, bundlerepo.bundlerepository):
    46         # We have to use a different caching property decorator for
    46         # We have to use a different caching property decorator for
    75             """
    75             """
    76             return narrowspec.load(self)
    76             return narrowspec.load(self)
    77 
    77 
    78         @localrepo.repofilecache(narrowspec.FILENAME)
    78         @localrepo.repofilecache(narrowspec.FILENAME)
    79         def _narrowmatch(self):
    79         def _narrowmatch(self):
       
    80             if changegroup.NARROW_REQUIREMENT not in self.requirements:
       
    81                 return matchmod.always(self.root, '')
    80             include, exclude = self.narrowpats
    82             include, exclude = self.narrowpats
    81             if not opts_narrow and not include and not exclude:
       
    82                 return matchmod.always(self.root, '')
       
    83             return narrowspec.match(self.root, include=include, exclude=exclude)
    83             return narrowspec.match(self.root, include=include, exclude=exclude)
    84 
    84 
    85         # TODO(martinvonz): make this property-like instead?
    85         # TODO(martinvonz): make this property-like instead?
    86         def narrowmatch(self):
    86         def narrowmatch(self):
    87             return self._narrowmatch
    87             return self._narrowmatch