diff mercurial/context.py @ 38818:e411774a2e0f

narrow: move status-filtering to core and to ctx One of my recent changes from repo.status(ctx1, ctx2) to ctx1.status(ctx2) broke some of our Google-internal tests. The problem turned out to be that the narrow extension was overriding repo.status() to make it filter out paths outside the narrowspec. When I changed to ctx1.status(ctx2), then that filtering obviously got lost. ctx.status() seems like a better method to do the filtering in, so this patch moves the filtering into that method, thereby also moving it out of the extension and into core. Differential Revision: https://phab.mercurial-scm.org/D4068
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 02 Aug 2018 23:50:47 -0700
parents e7aa113b14f7
children 2488dcfa71f8
line wrap: on
line diff
--- a/mercurial/context.py	Tue Jul 10 20:23:55 2018 +0530
+++ b/mercurial/context.py	Thu Aug 02 23:50:47 2018 -0700
@@ -372,6 +372,10 @@
                 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()