Mercurial > hg
comparison mercurial/match.py @ 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 |
comparison
equal
deleted
inserted
replaced
25576:d02f4b3e71f5 | 25577:a410479c7ee7 |
---|---|
222 This function's behavior is undefined if it has returned False for | 222 This function's behavior is undefined if it has returned False for |
223 one of the dir's parent directories. | 223 one of the dir's parent directories. |
224 ''' | 224 ''' |
225 if dir in self._excluderoots: | 225 if dir in self._excluderoots: |
226 return False | 226 return False |
227 parentdirs = None | |
228 if (self._includeroots and | 227 if (self._includeroots and |
229 dir not in self._includeroots and | 228 dir not in self._includeroots and |
230 dir not in self._includedirs): | 229 dir not in self._includedirs): |
231 parentdirs = list(util.finddirs(dir)) | 230 if not any(parent in self._includeroots |
232 if not any(parent in self._includeroots for parent in parentdirs): | 231 for parent in util.finddirs(dir)): |
233 return False | 232 return False |
234 return (not self._fileroots or | 233 return (not self._fileroots or |
235 '.' in self._fileroots or | 234 '.' in self._fileroots or |
236 dir in self._fileroots or | 235 dir in self._fileroots or |
237 dir in self._dirs or | 236 dir in self._dirs or |
238 any(parentdir in self._fileroots | 237 any(parentdir in self._fileroots |
239 for parentdir in parentdirs or util.finddirs(dir))) | 238 for parentdir in util.finddirs(dir))) |
240 | 239 |
241 def exact(self, f): | 240 def exact(self, f): |
242 '''Returns True if f is in .files().''' | 241 '''Returns True if f is in .files().''' |
243 return f in self._fileroots | 242 return f in self._fileroots |
244 | 243 |