##// END OF EJS Templates
Yield directories in dirstate.statwalk()
Emanuele Aina -
r4146:e287d61d default
parent child Browse files
Show More
@@ -357,7 +357,7 class dirstate(object):
357 357 yield src, f
358 358
359 359 def statwalk(self, files=None, match=util.always, ignored=False,
360 badmatch=None):
360 badmatch=None, directories=False):
361 361 '''
362 362 walk recursively through the directory tree, finding all files
363 363 matched by the match function
@@ -365,6 +365,7 class dirstate(object):
365 365 results are yielded in a tuple (src, filename, st), where src
366 366 is one of:
367 367 'f' the file was found in the directory tree
368 'd' the file is a directory of the tree
368 369 'm' the file was only in the dirstate and not in the tree
369 370 'b' file was not found and matched badmatch
370 371
@@ -394,6 +395,8 class dirstate(object):
394 395 # recursion free walker, faster than os.walk.
395 396 def findfiles(s):
396 397 work = [s]
398 if directories:
399 yield 'd', util.normpath(s[common_prefix_len:]), os.lstat(s)
397 400 while work:
398 401 top = work.pop()
399 402 names = os.listdir(top)
@@ -421,6 +424,8 class dirstate(object):
421 424 ds = util.pconvert(os.path.join(nd, f +'/'))
422 425 if imatch(ds):
423 426 work.append(p)
427 if directories:
428 yield 'd', np, st
424 429 if imatch(np) and np in dc:
425 430 yield 'm', np, st
426 431 elif imatch(np):
General Comments 0
You need to be logged in to leave comments. Login now