diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1271,8 +1271,7 @@ # Requested files could include files not in the local store. So # filter those out. - filematcher = matchmod.intersectmatchers(repo.narrowmatch(), - filematcher) + filematcher = repo.narrowmatch(filematcher) fn = _packermap[version][0] return fn(repo, filematcher, bundlecaps, ellipses=ellipses, diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -44,7 +44,6 @@ help, hg, logcmdutil, - match as matchmod, merge as mergemod, narrowspec, obsolete, @@ -1970,7 +1969,7 @@ diffopts = patch.diffallopts(ui, opts) m = scmutil.match(ctx2, pats, opts) - m = matchmod.intersectmatchers(m, repo.narrowmatch()) + m = repo.narrowmatch(m) ui.pager('diff') logcmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, listsubrepos=opts.get('subrepos'), diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1200,8 +1200,14 @@ include, exclude = self.narrowpats return narrowspec.match(self.root, include=include, exclude=exclude) - # TODO(martinvonz): make this property-like instead? - def narrowmatch(self): + def narrowmatch(self, match=None): + """matcher corresponding the the repo's narrowspec + + If `match` is given, then that will be intersected with the narrow + matcher. + """ + if match: + return matchmod.intersectmatchers(match, self._narrowmatch) return self._narrowmatch def setnarrowpats(self, newincludes, newexcludes):