~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-21 12:53:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120221125302-uhxdc14iays7k5wq
Add Tree.iter_child_entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
195
195
        """
196
196
        raise NotImplementedError(self.iter_entries_by_dir)
197
197
 
 
198
    def iter_child_entries(self, file_id, path=None):
 
199
        """Iterate over the children of a directory or tree reference.
 
200
 
 
201
        :param file_id: File id of the directory/tree-reference
 
202
        :param path: Optional path of the directory
 
203
        :return: Iterator over (name, entry) tuples
 
204
        """
 
205
        raise NotImplementedError(self.iter_child_entries)
 
206
 
198
207
    def list_files(self, include_root=False, from_dir=None, recursive=True):
199
208
        """List all files in this tree.
200
209
 
871
880
        return self.root_inventory.iter_entries_by_dir(
872
881
            specific_file_ids=inventory_file_ids, yield_parents=yield_parents)
873
882
 
 
883
    @needs_read_lock
 
884
    def iter_child_entries(self, file_id, path=None):
 
885
        inv, inv_file_id = self._unpack_file_id(file_id)
 
886
        return inv[inv_file_id].children.iteritems()
 
887
 
874
888
    @deprecated_method(deprecated_in((2, 5, 0)))
875
889
    def get_file_by_path(self, path):
876
890
        return self.get_file(self.path2id(path), path)