~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/revisiontree.py

  • Committer: Martin Packman
  • Date: 2012-01-05 09:50:04 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6426.
  • Revision ID: martin.packman@canonical.com-20120105095004-mia9xb7y0efmto0v
Merge bzr.dev to resolve conflicts in bzrlib.builtins

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""RevisionTree - a Tree implementation backed by repository data for a revision."""
18
18
 
 
19
from __future__ import absolute_import
 
20
 
19
21
from cStringIO import StringIO
20
22
 
21
23
from bzrlib import (
36
38
        self._revision_id = revision_id
37
39
        self._rules_searcher = None
38
40
 
 
41
    def has_versioned_directories(self):
 
42
        """See `Tree.has_versioned_directories`."""
 
43
        return self._repository._format.supports_versioned_directories
 
44
 
39
45
    def supports_tree_reference(self):
40
46
        return getattr(self._repository._format, "supports_tree_reference",
41
47
            False)
61
67
        raise NotImplementedError(self.get_file_revision)
62
68
 
63
69
    def get_file_text(self, file_id, path=None):
64
 
        _, content = list(self.iter_files_bytes([(file_id, None)]))[0]
65
 
        return ''.join(content)
 
70
        for (identifier, content) in self.iter_files_bytes([(file_id, None)]):
 
71
            ret = "".join(content)
 
72
        return ret
66
73
 
67
74
    def get_file(self, file_id, path=None):
68
75
        return StringIO(self.get_file_text(file_id))
211
218
    def iter_files_bytes(self, desired_files):
212
219
        """See Tree.iter_files_bytes.
213
220
 
214
 
        This version is implemented on top of Repository.extract_files_bytes"""
 
221
        This version is implemented on top of Repository.iter_files_bytes"""
215
222
        repo_desired_files = [(f, self.get_file_revision(f), i)
216
223
                              for f, i in desired_files]
217
224
        try:
218
225
            for result in self._repository.iter_files_bytes(repo_desired_files):
219
226
                yield result
220
227
        except errors.RevisionNotPresent, e:
221
 
            raise errors.NoSuchFile(e.revision_id)
 
228
            raise errors.NoSuchFile(e.file_id)
222
229
 
223
230
    def annotate_iter(self, file_id,
224
231
                      default_revision=revision.CURRENT_REVISION):