match: avoid accessing match._pathrestricted from subdirmatcher
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 12 May 2017 16:31:21 -0700
changeset 32324 77dac8fd30ee
parent 32323 0aa4032a97e1
child 32325 763d72925691
match: avoid accessing match._pathrestricted from subdirmatcher Accessing only the public API wherever possible helps us refactor matchers later.
mercurial/match.py
--- a/mercurial/match.py	Thu May 18 10:17:57 2017 -0700
+++ b/mercurial/match.py	Fri May 12 16:31:21 2017 -0700
@@ -381,7 +381,6 @@
         self._path = path
         self._matcher = matcher
         self._always = matcher._always
-        self._pathrestricted = matcher._pathrestricted
 
         self._files = [f[len(path) + 1:] for f in matcher._files
                        if f.startswith(path + "/")]
@@ -398,15 +397,18 @@
         # call the original matcher with the subdirectory path prepended.
         self.matchfn = lambda fn: matcher.matchfn(self._path + "/" + fn)
 
+    def bad(self, f, msg):
+        self._matcher.bad(self._path + "/" + f, msg)
+
     def abs(self, f):
         return self._matcher.abs(self._path + "/" + f)
 
-    def bad(self, f, msg):
-        self._matcher.bad(self._path + "/" + f, msg)
-
     def rel(self, f):
         return self._matcher.rel(self._path + "/" + f)
 
+    def uipath(self, f):
+        return self._matcher.uipath(self._path + "/" + f)
+
     def visitdir(self, dir):
         if dir == '.':
             dir = self._path