/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/transform.py

  • Committer: Aaron Bentley
  • Date: 2008-06-25 21:28:30 UTC
  • mto: (3363.10.8 preview-post)
  • mto: This revision was merged to the branch mainline in revision 3663.
  • Revision ID: aaron@aaronbentley.com-20080625212830-028oh2tvta8hccc0
Cheap implementation of list_files

Show diffs side-by-side

added added

removed removed

Lines of Context:
1567
1567
                parent_file_id, file_id)
1568
1568
            yield new_entry, trans_id
1569
1569
 
1570
 
    def iter_entries_by_dir(self, specific_file_ids=None):
1571
 
        # This may not be a maximally efficient implementation, but it is
1572
 
        # reasonably straightforward.  An implementation that grafts the
1573
 
        # TreeTransform changes onto the tree's iter_entries_by_dir results
1574
 
        # might be more efficient, but requires tricky inferences about stack
1575
 
        # position.
 
1570
    def _list_files_by_dir(self):
1576
1571
        todo = [ROOT_PARENT]
1577
1572
        ordered_ids = []
1578
1573
        while len(todo) > 0:
1584
1579
            todo.extend(children)
1585
1580
            for trans_id in children:
1586
1581
                ordered_ids.append((trans_id, parent_file_id))
 
1582
        return ordered_ids
 
1583
 
 
1584
    def iter_entries_by_dir(self, specific_file_ids=None):
 
1585
        # This may not be a maximally efficient implementation, but it is
 
1586
        # reasonably straightforward.  An implementation that grafts the
 
1587
        # TreeTransform changes onto the tree's iter_entries_by_dir results
 
1588
        # might be more efficient, but requires tricky inferences about stack
 
1589
        # position.
 
1590
        ordered_ids = self._list_files_by_dir()
1587
1591
        for entry, trans_id in self._make_inv_entries(ordered_ids,
1588
1592
                                                      specific_file_ids):
1589
1593
            yield unicode(self._final_paths.get_path(trans_id)), entry
1590
1594
 
 
1595
    def list_files(self, include_root=False):
 
1596
        """See Tree.list_files."""
 
1597
        # XXX This should behave like WorkingTree.list_files, but is really
 
1598
        # more like RevisionTree.list_files.
 
1599
        for path, entry in self.iter_entries_by_dir():
 
1600
            if entry.name == '' and not include_root:
 
1601
                continue
 
1602
            yield path, 'V', entry, entry.kind, entry.file_id, entry
 
1603
 
1591
1604
    def kind(self, file_id):
1592
1605
        trans_id = self._transform.trans_id_file_id(file_id)
1593
1606
        return self._transform.final_kind(trans_id)