875
875
to exclude some directories, they are then not descended into.
877
877
The data yielded is of the form:
878
[(relpath, basename, kind, lstat, path_from_top), ...]
878
((directory-relpath, directory-path-from-root),
879
[(relpath, basename, kind, lstat), ...]),
880
- directory-relpath is the containing dirs relpath from prefix
881
- directory-path-from-root is the containing dirs path from /
882
- relpath is the relative path within the subtree being walked.
883
- basename is the basename of the path
884
- kind is the kind of the file now. If unknonwn then the file is not
885
present within the tree - but it may be recorded as versioned. See
887
- lstat is the stat data *if* the file was statted.
888
- planned, not implemented:
889
path_from_tree_root is the path from the root of the tree.
880
891
:param prefix: Prefix the relpaths that are yielded with 'prefix'. This
881
892
allows one to walk a subtree but get paths that are relative to a tree
882
893
rooted higher up.
883
894
:return: an iterator over the dirs.
896
#TODO there is a bit of a smell where the results of the directory-
897
# summary in this, and the path from the root, may not agree
898
# depending on top and prefix - i.e. ./foo and foo as a pair leads to
899
# potentially confusing output. We should make this more robust - but
900
# not at a speed cot. RBC 20060731
887
903
_directory = _directory_kind
900
916
abspath = top + '/' + name
901
917
statvalue = lstat(abspath)
902
918
dirblock.append ((relroot + name, name, file_kind_from_stat_mode(statvalue.st_mode), statvalue, abspath))
919
yield (currentdir[0], top), dirblock
904
920
# push the user specified dirs from dirblock
905
921
for dir in reversed(dirblock):
906
922
if dir[2] == _directory: