~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:51:25 UTC
  • mfrom: (6468.3.1 bzr)
  • mto: This revision was merged to the branch mainline in revision 6519.
  • Revision ID: jelmer@samba.org-20120221125125-7cpkwjmvf3aj2d9x
MergeĀ lp:~jelmer/bzr/use-tree-iter-children

Show diffs side-by-side

added added

removed removed

Lines of Context:
532
532
        return find_ids_across_trees(paths, [self] + list(trees), require_versioned)
533
533
 
534
534
    def iter_children(self, file_id):
535
 
        entry = self.iter_entries_by_dir([file_id]).next()[1]
536
 
        for child in getattr(entry, 'children', {}).itervalues():
537
 
            yield child.file_id
 
535
        """Iterate over the file ids of the children of an entry.
 
536
 
 
537
        :param file_id: File id of the entry
 
538
        :return: Iterator over child file ids.
 
539
        """
 
540
        raise NotImplementedError(self.iter_children)
538
541
 
539
542
    def lock_read(self):
540
543
        """Lock this tree for multiple read only operations.
541
 
        
 
544
 
542
545
        :return: A bzrlib.lock.LogicalLockResult.
543
546
        """
544
547
        pass
872
875
    def get_file_by_path(self, path):
873
876
        return self.get_file(self.path2id(path), path)
874
877
 
 
878
    def iter_children(self, file_id, path=None):
 
879
        """See Tree.iter_children."""
 
880
        entry = self.iter_entries_by_dir([file_id]).next()[1]
 
881
        for child in getattr(entry, 'children', {}).itervalues():
 
882
            yield child.file_id
 
883
 
875
884
 
876
885
def find_ids_across_trees(filenames, trees, require_versioned=True):
877
886
    """Find the ids corresponding to specified filenames.
1335
1344
                        if old_entry is None:
1336
1345
                            # Reusing a discarded change.
1337
1346
                            old_entry = self._get_entry(self.source, file_id)
1338
 
                        for child in old_entry.children.values():
 
1347
                        for child in self.source.iter_children(file_id):
1339
1348
                            precise_file_ids.add(child.file_id)
1340
1349
                    changed_file_ids.add(result[0])
1341
1350
                    yield result