~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transform.py

  • Committer: John Arbash Meinel
  • Date: 2009-06-04 16:50:33 UTC
  • mto: This revision was merged to the branch mainline in revision 4410.
  • Revision ID: john@arbash-meinel.com-20090604165033-bfdo0lyf4yt4vjcz
We don't need a base Coder class, because Decoder._update_tail is different than Encoder._update_tail.
(one adds, one subtracts from self.size).
So we now have 2 versions of the macro, and the test suite stops crashing... :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1748
1748
            if self._transform.final_file_id(trans_id) is None:
1749
1749
                yield self._final_paths._determine_path(trans_id)
1750
1750
 
1751
 
    def _make_inv_entries(self, ordered_entries, specific_file_ids=None):
 
1751
    def _make_inv_entries(self, ordered_entries, specific_file_ids):
1752
1752
        for trans_id, parent_file_id in ordered_entries:
1753
1753
            file_id = self._transform.final_file_id(trans_id)
1754
1754
            if file_id is None:
1791
1791
                                                      specific_file_ids):
1792
1792
            yield unicode(self._final_paths.get_path(trans_id)), entry
1793
1793
 
1794
 
    def _iter_entries_for_dir(self, dir_path):
1795
 
        """Return path, entry for items in a directory without recursing down."""
1796
 
        dir_file_id = self.path2id(dir_path)
1797
 
        ordered_ids = []
1798
 
        for file_id in self.iter_children(dir_file_id):
1799
 
            trans_id = self._transform.trans_id_file_id(file_id)
1800
 
            ordered_ids.append((trans_id, file_id))
1801
 
        for entry, trans_id in self._make_inv_entries(ordered_ids):
1802
 
            yield unicode(self._final_paths.get_path(trans_id)), entry
1803
 
 
1804
 
    def list_files(self, include_root=False, from_dir=None, recursive=True):
1805
 
        """See WorkingTree.list_files."""
 
1794
    def list_files(self, include_root=False):
 
1795
        """See Tree.list_files."""
1806
1796
        # XXX This should behave like WorkingTree.list_files, but is really
1807
1797
        # more like RevisionTree.list_files.
1808
 
        if recursive:
1809
 
            prefix = None
1810
 
            if from_dir:
1811
 
                prefix = from_dir + '/'
1812
 
            entries = self.iter_entries_by_dir()
1813
 
            for path, entry in entries:
1814
 
                if entry.name == '' and not include_root:
1815
 
                    continue
1816
 
                if prefix:
1817
 
                    if not path.startswith(prefix):
1818
 
                        continue
1819
 
                    path = path[len(prefix):]
1820
 
                yield path, 'V', entry.kind, entry.file_id, entry
1821
 
        else:
1822
 
            if from_dir is None and include_root is True:
1823
 
                root_entry = inventory.make_entry('directory', '',
1824
 
                    ROOT_PARENT, self.get_root_id())
1825
 
                yield '', 'V', 'directory', root_entry.file_id, root_entry
1826
 
            entries = self._iter_entries_for_dir(from_dir or '')
1827
 
            for path, entry in entries:
1828
 
                yield path, 'V', entry.kind, entry.file_id, entry
 
1798
        for path, entry in self.iter_entries_by_dir():
 
1799
            if entry.name == '' and not include_root:
 
1800
                continue
 
1801
            yield path, 'V', entry.kind, entry.file_id, entry
1829
1802
 
1830
1803
    def kind(self, file_id):
1831
1804
        trans_id = self._transform.trans_id_file_id(file_id)