##// END OF EJS Templates
dirstate: don't walk ignored directories...
Alexis S. L. Carvalho -
r6032:b41f0d6a default
parent child Browse files
Show More
@@ -369,6 +369,14 b' class dirstate(object):'
369 % (self.pathto(f), kind))
369 % (self.pathto(f), kind))
370 return False
370 return False
371
371
372 def _dirignore(self, f):
373 if self._ignore(f):
374 return True
375 for c in strutil.findall(f, '/'):
376 if self._ignore(f[:c]):
377 return True
378 return False
379
372 def walk(self, files=None, match=util.always, badmatch=None):
380 def walk(self, files=None, match=util.always, badmatch=None):
373 # filter out the stat
381 # filter out the stat
374 for src, f, st in self.statwalk(files, match, badmatch=badmatch):
382 for src, f, st in self.statwalk(files, match, badmatch=badmatch):
@@ -404,9 +412,11 b' class dirstate(object):'
404 return match(file_)
412 return match(file_)
405
413
406 ignore = self._ignore
414 ignore = self._ignore
415 dirignore = self._dirignore
407 if ignored:
416 if ignored:
408 imatch = match
417 imatch = match
409 ignore = util.never
418 ignore = util.never
419 dirignore = util.never
410
420
411 # self._root may end with a path separator when self._root == '/'
421 # self._root may end with a path separator when self._root == '/'
412 common_prefix_len = len(self._root)
422 common_prefix_len = len(self._root)
@@ -492,8 +502,9 b' class dirstate(object):'
492 yield 'b', ff, None
502 yield 'b', ff, None
493 continue
503 continue
494 if s_isdir(st.st_mode):
504 if s_isdir(st.st_mode):
495 for f, src, st in findfiles(f):
505 if not dirignore(nf):
496 yield src, f, st
506 for f, src, st in findfiles(f):
507 yield src, f, st
497 else:
508 else:
498 if nf in known:
509 if nf in known:
499 continue
510 continue
@@ -92,6 +92,13 b' hg rm fenugreek'
92 debugwalk fenugreek
92 debugwalk fenugreek
93 touch new
93 touch new
94 debugwalk new
94 debugwalk new
95
96 mkdir ignored
97 touch ignored/file
98 echo '^ignored$' > .hgignore
99 debugwalk ignored
100 debugwalk ignored/file
101
95 chdir ..
102 chdir ..
96 debugwalk -R t t/mammals/skunk
103 debugwalk -R t t/mammals/skunk
97 mkdir t2
104 mkdir t2
@@ -278,6 +278,11 b' m fenugreek fenugreek exact'
278 hg debugwalk new
278 hg debugwalk new
279 f new new exact
279 f new new exact
280
280
281 hg debugwalk ignored
282
283 hg debugwalk ignored/file
284 f ignored/file ignored/file exact
285
281 cd ..
286 cd ..
282
287
283 hg debugwalk -R t t/mammals/skunk
288 hg debugwalk -R t t/mammals/skunk
General Comments 0
You need to be logged in to leave comments. Login now