~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/testament.py

(mbp) merge bzr.dev to 0.8, prepare for release

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    Testaments can be 
83
83
 
84
84
      - produced from a revision
85
 
      - writen to a stream
 
85
      - written to a stream
86
86
      - loaded from a stream
87
87
      - compared to a revision
88
88
    """
89
89
 
90
90
    @classmethod
91
 
    def from_revision(cls, branch, revision_id):
 
91
    def from_revision(cls, repository, revision_id):
92
92
        """Produce a new testament from a historical revision"""
93
 
        rev = branch.get_revision(revision_id)
94
 
        inventory = branch.get_inventory(revision_id)
 
93
        rev = repository.get_revision(revision_id)
 
94
        inventory = repository.get_inventory(revision_id)
95
95
        return cls(rev, inventory)
96
96
 
97
97
    def __init__(self, rev, inventory):
114
114
        hashed in that encoding.
115
115
        """
116
116
        r = []
117
 
        def a(s):
118
 
            r.append(s)
 
117
        a = r.append
119
118
        a('bazaar-ng testament version 1\n')
120
119
        a('revision-id: %s\n' % self.revision_id)
121
120
        a('committer: %s\n' % self.committer)
137
136
            for l in r:
138
137
                assert isinstance(l, basestring), \
139
138
                    '%r of type %s is not a plain string' % (l, type(l))
140
 
        return r
 
139
        return [line.encode('utf-8') for line in r]
141
140
 
142
141
    def _escape_path(self, path):
143
142
        assert not contains_linebreaks(path)