##// END OF EJS Templates
match: more accurately report when we're always going to match...
Bryan O'Sullivan -
r18713:8728579f default
parent child Browse files
Show More
@@ -62,6 +62,7 b' class match(object):'
62 self._files = []
62 self._files = []
63 self._anypats = bool(include or exclude)
63 self._anypats = bool(include or exclude)
64 self._ctx = ctx
64 self._ctx = ctx
65 self._always = False
65
66
66 if include:
67 if include:
67 pats = _normalize(include, 'glob', root, cwd, auditor)
68 pats = _normalize(include, 'glob', root, cwd, auditor)
@@ -103,6 +104,7 b' class match(object):'
103 m = lambda f: not em(f)
104 m = lambda f: not em(f)
104 else:
105 else:
105 m = lambda f: True
106 m = lambda f: True
107 self._always = True
106
108
107 self.matchfn = m
109 self.matchfn = m
108 self._fmap = set(self._files)
110 self._fmap = set(self._files)
@@ -130,7 +132,7 b' class match(object):'
130 def anypats(self):
132 def anypats(self):
131 return self._anypats
133 return self._anypats
132 def always(self):
134 def always(self):
133 return False
135 return self._always
134
136
135 class exact(match):
137 class exact(match):
136 def __init__(self, root, cwd, files):
138 def __init__(self, root, cwd, files):
@@ -139,8 +141,7 b' class exact(match):'
139 class always(match):
141 class always(match):
140 def __init__(self, root, cwd):
142 def __init__(self, root, cwd):
141 match.__init__(self, root, cwd, [])
143 match.__init__(self, root, cwd, [])
142 def always(self):
144 self._always = True
143 return True
144
145
145 class narrowmatcher(match):
146 class narrowmatcher(match):
146 """Adapt a matcher to work on a subdirectory only.
147 """Adapt a matcher to work on a subdirectory only.
@@ -175,6 +176,7 b' class narrowmatcher(match):'
175 self._cwd = matcher._cwd
176 self._cwd = matcher._cwd
176 self._path = path
177 self._path = path
177 self._matcher = matcher
178 self._matcher = matcher
179 self._always = matcher._always
178
180
179 self._files = [f[len(path) + 1:] for f in matcher._files
181 self._files = [f[len(path) + 1:] for f in matcher._files
180 if f.startswith(path + "/")]
182 if f.startswith(path + "/")]
General Comments 0
You need to be logged in to leave comments. Login now