mercurial/localrepo.py
changeset 40086 41fcdfe3bfeb
parent 40082 4fd0fac48922
child 40267 9d5ddf55415b
--- a/mercurial/localrepo.py	Fri Sep 28 22:35:05 2018 -0700
+++ b/mercurial/localrepo.py	Mon Oct 01 10:11:00 2018 -0700
@@ -1200,13 +1200,22 @@
         include, exclude = self.narrowpats
         return narrowspec.match(self.root, include=include, exclude=exclude)
 
-    def narrowmatch(self, match=None):
+    def narrowmatch(self, match=None, includeexact=False):
         """matcher corresponding the the repo's narrowspec
 
         If `match` is given, then that will be intersected with the narrow
         matcher.
+
+        If `includeexact` is True, then any exact matches from `match` will
+        be included even if they're outside the narrowspec.
         """
         if match:
+            if includeexact and not self._narrowmatch.always():
+                # do not exclude explicitly-specified paths so that they can
+                # be warned later on
+                em = matchmod.exact(match._root, match._cwd, match.files())
+                nm = matchmod.unionmatcher([self._narrowmatch, em])
+                return matchmod.intersectmatchers(match, nm)
             return matchmod.intersectmatchers(match, self._narrowmatch)
         return self._narrowmatch