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