1567
1567
parent_file_id, file_id)
1568
1568
yield new_entry, trans_id
1570
def iter_entries_by_dir(self, specific_file_ids=None):
1571
# This may not be a maximally efficient implementation, but it is
1572
# reasonably straightforward. An implementation that grafts the
1573
# TreeTransform changes onto the tree's iter_entries_by_dir results
1574
# might be more efficient, but requires tricky inferences about stack
1570
def _list_files_by_dir(self):
1576
1571
todo = [ROOT_PARENT]
1577
1572
ordered_ids = []
1578
1573
while len(todo) > 0:
1584
1579
todo.extend(children)
1585
1580
for trans_id in children:
1586
1581
ordered_ids.append((trans_id, parent_file_id))
1584
def iter_entries_by_dir(self, specific_file_ids=None):
1585
# This may not be a maximally efficient implementation, but it is
1586
# reasonably straightforward. An implementation that grafts the
1587
# TreeTransform changes onto the tree's iter_entries_by_dir results
1588
# might be more efficient, but requires tricky inferences about stack
1590
ordered_ids = self._list_files_by_dir()
1587
1591
for entry, trans_id in self._make_inv_entries(ordered_ids,
1588
1592
specific_file_ids):
1589
1593
yield unicode(self._final_paths.get_path(trans_id)), entry
1595
def list_files(self, include_root=False):
1596
"""See Tree.list_files."""
1597
# XXX This should behave like WorkingTree.list_files, but is really
1598
# more like RevisionTree.list_files.
1599
for path, entry in self.iter_entries_by_dir():
1600
if entry.name == '' and not include_root:
1602
yield path, 'V', entry, entry.kind, entry.file_id, entry
1591
1604
def kind(self, file_id):
1592
1605
trans_id = self._transform.trans_id_file_id(file_id)
1593
1606
return self._transform.final_kind(trans_id)