898
898
# TODO: jam 20070215 This is the cheap way by cheating and using the
899
899
# RevisionTree implementation.
900
900
# This should be cleaned up to use the much faster Dirstate code
901
# This is a little tricky, though, because the dirstate is
902
# indexed by current path, not by parent path.
903
# So for now, we just build up the parent inventory, and extract
904
# it the same way RevisionTree does.
901
905
_directory = 'directory'
906
inv = self._get_inventory()
903
907
top_id = inv.path2id(prefix)
904
908
if top_id is None:
907
pending = [(prefix, '', _directory, None, top_id, None)]
911
pending = [(prefix, top_id)]
910
currentdir = pending.pop()
911
# 0 - relpath, 1- basename, 2- kind, 3- stat, id, v-kind
913
relroot = currentdir[0] + '/'
914
relpath, file_id = pending.pop()
915
# 0 - relpath, 1- file-id
917
relroot = relpath + '/'
916
920
# FIXME: stash the node in pending
917
entry = inv[currentdir[4]]
918
922
for name, child in entry.sorted_children():
919
923
toppath = relroot + name
920
924
dirblock.append((toppath, name, child.kind, None,
921
925
child.file_id, child.kind
923
yield (currentdir[0], entry.file_id), dirblock
927
yield (relpath, entry.file_id), dirblock
924
928
# push the user specified dirs from dirblock
925
929
for dir in reversed(dirblock):
926
930
if dir[2] == _directory:
931
pending.append((dir[0], dir[4]))