--- a/mercurial/match.py Sun Jul 09 15:19:27 2017 -0700
+++ b/mercurial/match.py Sun Jul 09 17:02:09 2017 -0700
@@ -307,20 +307,25 @@
'''
return False
- def anypats(self):
- '''Matcher uses patterns or include/exclude.'''
- return False
-
def always(self):
- '''Matcher will match everything and .files() will be empty
- - optimization might be possible and necessary.'''
+ '''Matcher will match everything and .files() will be empty --
+ optimization might be possible.'''
return False
def isexact(self):
+ '''Matcher will match exactly the list of files in .files() --
+ optimization might be possible.'''
return False
def prefix(self):
- return not self.always() and not self.isexact() and not self.anypats()
+ '''Matcher will match the paths in .files() recursively --
+ optimization might be possible.'''
+ return False
+
+ def anypats(self):
+ '''None of .always(), .isexact(), and .prefix() is true --
+ optimizations will be difficult.'''
+ return not self.always() and not self.isexact() and not self.prefix()
class alwaysmatcher(basematcher):
'''Matches everything.'''
@@ -385,8 +390,8 @@
any(parentdir in self._fileset
for parentdir in util.finddirs(dir)))
- def anypats(self):
- return self._anypats
+ def prefix(self):
+ return not self._anypats
def __repr__(self):
return ('<patternmatcher patterns=%r>' % self._pats)
@@ -416,9 +421,6 @@
any(parentdir in self._roots
for parentdir in util.finddirs(dir)))
- def anypats(self):
- return True
-
def __repr__(self):
return ('<includematcher includes=%r>' % self._pats)
@@ -497,9 +499,6 @@
def isexact(self):
return self._m1.isexact()
- def anypats(self):
- return self._m1.anypats() or self._m2.anypats()
-
def __repr__(self):
return ('<differencematcher m1=%r, m2=%r>' % (self._m1, self._m2))
@@ -566,9 +565,6 @@
def isexact(self):
return self._m1.isexact() or self._m2.isexact()
- def anypats(self):
- return self._m1.anypats() or self._m2.anypats()
-
def __repr__(self):
return ('<intersectionmatcher m1=%r, m2=%r>' % (self._m1, self._m2))
@@ -645,8 +641,8 @@
def always(self):
return self._always
- def anypats(self):
- return self._matcher.anypats()
+ def prefix(self):
+ return self._matcher.prefix() and not self._always
def __repr__(self):
return ('<subdirmatcher path=%r, matcher=%r>' %
@@ -662,12 +658,6 @@
def __call__(self, value):
return value in self._includes or self._matcher(value)
- def anypats(self):
- return True
-
- def prefix(self):
- return False
-
def __repr__(self):
return ('<forceincludematcher matcher=%r, includes=%r>' %
(self._matcher, sorted(self._includes)))
@@ -683,12 +673,6 @@
return True
return False
- def anypats(self):
- return True
-
- def prefix(self):
- return False
-
def __repr__(self):
return ('<unionmatcher matchers=%r>' % self._matchers)
@@ -699,9 +683,6 @@
def __call__(self, value):
return not self._matcher(value)
- def anypats(self):
- return True
-
def __repr__(self):
return ('<negatematcher matcher=%r>' % self._matcher)