1748
1748
if self._transform.final_file_id(trans_id) is None:
1749
1749
yield self._final_paths._determine_path(trans_id)
1751
def _make_inv_entries(self, ordered_entries, specific_file_ids):
1751
def _make_inv_entries(self, ordered_entries, specific_file_ids=None):
1752
1752
for trans_id, parent_file_id in ordered_entries:
1753
1753
file_id = self._transform.final_file_id(trans_id)
1754
1754
if file_id is None:
1791
1791
specific_file_ids):
1792
1792
yield unicode(self._final_paths.get_path(trans_id)), entry
1794
def list_files(self, include_root=False):
1795
"""See Tree.list_files."""
1794
def _iter_entries_for_dir(self, dir_path):
1795
"""Return path, entry for items in a directory without recursing down."""
1796
dir_file_id = self.path2id(dir_path)
1798
for file_id in self.iter_children(dir_file_id):
1799
trans_id = self._transform.trans_id_file_id(file_id)
1800
ordered_ids.append((trans_id, file_id))
1801
for entry, trans_id in self._make_inv_entries(ordered_ids):
1802
yield unicode(self._final_paths.get_path(trans_id)), entry
1804
def list_files(self, include_root=False, from_dir=None, recursive=True):
1805
"""See WorkingTree.list_files."""
1796
1806
# XXX This should behave like WorkingTree.list_files, but is really
1797
1807
# more like RevisionTree.list_files.
1798
for path, entry in self.iter_entries_by_dir():
1799
if entry.name == '' and not include_root:
1801
yield path, 'V', entry.kind, entry.file_id, entry
1811
prefix = from_dir + '/'
1812
entries = self.iter_entries_by_dir()
1813
for path, entry in entries:
1814
if entry.name == '' and not include_root:
1817
if not path.startswith(prefix):
1819
path = path[len(prefix):]
1820
yield path, 'V', entry.kind, entry.file_id, entry
1822
if from_dir is None and include_root is True:
1823
root_entry = inventory.make_entry('directory', '',
1824
ROOT_PARENT, self.get_root_id())
1825
yield '', 'V', 'directory', root_entry.file_id, root_entry
1826
entries = self._iter_entries_for_dir(from_dir or '')
1827
for path, entry in entries:
1828
yield path, 'V', entry.kind, entry.file_id, entry
1803
1830
def kind(self, file_id):
1804
1831
trans_id = self._transform.trans_id_file_id(file_id)