~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-06-17 04:55:38 UTC
  • mfrom: (4449.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090617045538-5mmdqd346tv8q67m
(igc) add recursion control to list_files() API

Show diffs side-by-side

added added

removed removed

Lines of Context:
1844
1844
            return None
1845
1845
        return ie.executable
1846
1846
 
1847
 
    def list_files(self, include_root=False):
 
1847
    def list_files(self, include_root=False, from_dir=None, recursive=True):
1848
1848
        # We use a standard implementation, because DirStateRevisionTree is
1849
1849
        # dealing with one of the parents of the current state
1850
1850
        inv = self._get_inventory()
1851
 
        entries = inv.iter_entries()
1852
 
        if self.inventory.root is not None and not include_root:
 
1851
        if from_dir is None:
 
1852
            from_dir_id = None
 
1853
        else:
 
1854
            from_dir_id = inv.path2id(from_dir)
 
1855
            if from_dir_id is None:
 
1856
                # Directory not versioned
 
1857
                return
 
1858
        entries = inv.iter_entries(from_dir=from_dir_id, recursive=recursive)
 
1859
        if inv.root is not None and not include_root and from_dir is None:
1853
1860
            entries.next()
1854
1861
        for path, entry in entries:
1855
1862
            yield path, 'V', entry.kind, entry.file_id, entry