~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-23 19:39:07 UTC
  • mfrom: (6468.3.3 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20120223193907-11erj8xxjmrchawp
(jelmer) Use Tree.iter_children() in a couple more places. (Jelmer Vernooij)

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():
1339
 
                            precise_file_ids.add(child.file_id)
 
1347
                        for child in self.source.iter_children(file_id):
 
1348
                            precise_file_ids.add(child)
1340
1349
                    changed_file_ids.add(result[0])
1341
1350
                    yield result
1342
1351