diff mercurial/context.py @ 40083:48a0ce67d67a

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
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 27 Sep 2018 23:01:26 -0700
parents b6c2543e1dd8
children 2cf18f46a1ce
line wrap: on
line diff
--- 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()