changeset 25577:a410479c7ee7

match: drop optimization (?) of 'parentdirs' calculation It seems unlikely that the optimization to avoid calling util.finddirs twice will be noticeable, so let's drop it. This makes the two conditions for includes and regular patterns more similar.
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 27 May 2015 11:47:55 -0700
parents d02f4b3e71f5
children 4b1ec70b9713
files mercurial/match.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/match.py	Wed May 27 09:34:00 2015 -0700
+++ b/mercurial/match.py	Wed May 27 11:47:55 2015 -0700
@@ -224,19 +224,18 @@
         '''
         if dir in self._excluderoots:
             return False
-        parentdirs = None
         if (self._includeroots and
             dir not in self._includeroots and
             dir not in self._includedirs):
-            parentdirs = list(util.finddirs(dir))
-            if not any(parent in self._includeroots for parent in parentdirs):
+            if not any(parent in self._includeroots
+                       for parent in util.finddirs(dir)):
                 return False
         return (not self._fileroots or
                 '.' in self._fileroots or
                 dir in self._fileroots or
                 dir in self._dirs or
                 any(parentdir in self._fileroots
-                    for parentdir in parentdirs or util.finddirs(dir)))
+                    for parentdir in util.finddirs(dir)))
 
     def exact(self, f):
         '''Returns True if f is in .files().'''