/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

extend list_files() with from_dir and recursive parameters

Show diffs side-by-side

added added

removed removed

Lines of Context:
1829
1829
            return None
1830
1830
        return ie.executable
1831
1831
 
1832
 
    def list_files(self, include_root=False):
 
1832
    def list_files(self, include_root=False, from_dir=None, recursive=True):
1833
1833
        # We use a standard implementation, because DirStateRevisionTree is
1834
1834
        # dealing with one of the parents of the current state
1835
1835
        inv = self._get_inventory()
1836
 
        entries = inv.iter_entries()
1837
 
        if self.inventory.root is not None and not include_root:
 
1836
        if from_dir is None:
 
1837
            from_dir_id = None
 
1838
        else:
 
1839
            from_dir_id = inv.path2id(from_dir)
 
1840
        entries = inv.iter_entries(from_dir=from_dir_id, recursive=recursive)
 
1841
        if inv.root is not None and not include_root and from_dir is None:
1838
1842
            entries.next()
1839
1843
        for path, entry in entries:
1840
1844
            yield path, 'V', entry.kind, entry.file_id, entry