# HG changeset patch # User Martin von Zweigbergk # Date 1538114486 25200 # Node ID 48a0ce67d67aea5a91982e042523f6b327a3e35d # Parent 4fd0fac4892213a5f3a6a460366e026a42e66cff status: intersect matcher with narrow matcher instead of filtering afterwards I seem to have done a very naive move of the code from the narrow extension into core in e411774a2e0f (narrow: move status-filtering to core and to ctx, 2018-08-02). It seems obvious that a better way is to intersect the matchers. Note that this means that when requesting status for the working directory in a narrow repo, we now pass the narrow matcher (possibly intersected with a user-provided matcher) into _buildstatus() and then into dirstate.status() and dirstate.walk(), which will the intersect it again with the narrow matcher. That's functionally fine, but wasteful. I hope to later remove the dirstate wrapping that adds the second layer of matcher intersection. Differential Revision: https://phab.mercurial-scm.org/D4897 diff -r 4fd0fac48922 -r 48a0ce67d67a mercurial/context.py --- a/mercurial/context.py Fri Sep 28 12:29:21 2018 -0700 +++ b/mercurial/context.py Thu Sep 27 23:01:26 2018 -0700 @@ -343,7 +343,7 @@ reversed = True ctx1, ctx2 = ctx2, ctx1 - match = match or matchmod.always(self._repo.root, self._repo.getcwd()) + match = self._repo.narrowmatch(match) match = ctx2._matchstatus(ctx1, match) r = scmutil.status([], [], [], [], [], [], []) r = ctx2._buildstatus(ctx1, r, match, listignored, listclean, @@ -371,10 +371,6 @@ for rfiles, sfiles in zip(r, s): rfiles.extend("%s/%s" % (subpath, f) for f in sfiles) - narrowmatch = self._repo.narrowmatch() - if not narrowmatch.always(): - for l in r: - l[:] = list(filter(narrowmatch, l)) for l in r: l.sort()