Mercurial > hg
comparison mercurial/match.py @ 25114:d1d69ca78883
match: add match.ispartial()
match.ispartial() will return the opposite of match.always() in core, but this
function will be extensible by extensions to produce another result even
if match.always() will be untouched.
This will be useful for narrowhg, where ispartial() will return False even if
the match won't always match. This would happen in the case where the only
time the match function is False is when the path is outside of the narrow
spec.
author | Drew Gottlieb <drgott@google.com> |
---|---|
date | Fri, 15 May 2015 15:43:26 -0700 |
parents | baa11dde8c0e |
children | 755d23a49170 |
comparison
equal
deleted
inserted
replaced
25113:0ca8410ea345 | 25114:d1d69ca78883 |
---|---|
183 | 183 |
184 def always(self): | 184 def always(self): |
185 '''Matcher will match everything and .files() will be empty | 185 '''Matcher will match everything and .files() will be empty |
186 - optimization might be possible and necessary.''' | 186 - optimization might be possible and necessary.''' |
187 return self._always | 187 return self._always |
188 | |
189 def ispartial(self): | |
190 '''True if the matcher won't always match. | |
191 | |
192 Although it's just the inverse of _always in this implementation, | |
193 an extenion such as narrowhg might make it return something | |
194 slightly different.''' | |
195 return not self._always | |
188 | 196 |
189 def isexact(self): | 197 def isexact(self): |
190 return self.matchfn == self.exact | 198 return self.matchfn == self.exact |
191 | 199 |
192 def _normalize(self, patterns, default, root, cwd, auditor): | 200 def _normalize(self, patterns, default, root, cwd, auditor): |