/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 breezy/revisiontree.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

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 io import BytesIO
 
19
from __future__ import absolute_import
 
20
 
20
21
from . import (
21
 
    lock,
 
22
    errors,
22
23
    revision,
23
24
    tree,
24
25
    )
 
26
from .sixish import (
 
27
    BytesIO,
 
28
    )
25
29
 
26
30
 
27
31
class RevisionTree(tree.Tree):
41
45
 
42
46
    def supports_tree_reference(self):
43
47
        return getattr(self._repository._format, "supports_tree_reference",
44
 
                       False)
 
48
            False)
45
49
 
46
50
    def get_parent_ids(self):
47
51
        """See Tree.get_parent_ids.
59
63
        """Return the revision id associated with this tree."""
60
64
        return self._revision_id
61
65
 
62
 
    def get_file_revision(self, path):
 
66
    def get_file_revision(self, file_id, path=None):
63
67
        """Return the revision id in which a file was last changed."""
64
68
        raise NotImplementedError(self.get_file_revision)
65
69
 
66
 
    def get_file_text(self, path):
67
 
        for (identifier, content) in self.iter_files_bytes([(path, None)]):
68
 
            ret = b"".join(content)
 
70
    def get_file_text(self, file_id, path=None):
 
71
        for (identifier, content) in self.iter_files_bytes([(file_id, None)]):
 
72
            ret = "".join(content)
69
73
        return ret
70
74
 
71
 
    def get_file(self, path):
72
 
        return BytesIO(self.get_file_text(path))
 
75
    def get_file(self, file_id, path=None):
 
76
        return BytesIO(self.get_file_text(file_id))
73
77
 
74
78
    def is_locked(self):
75
79
        return self._repository.is_locked()
76
80
 
77
81
    def lock_read(self):
78
82
        self._repository.lock_read()
79
 
        return lock.LogicalLockResult(self.unlock)
 
83
        return self
80
84
 
81
85
    def __repr__(self):
82
86
        return '<%s instance at %x, rev_id=%r>' % (
89
93
        """See Tree._get_rules_searcher."""
90
94
        if self._rules_searcher is None:
91
95
            self._rules_searcher = super(RevisionTree,
92
 
                                         self)._get_rules_searcher(default_searcher)
 
96
                self)._get_rules_searcher(default_searcher)
93
97
        return self._rules_searcher