~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/testament.py

  • Committer: Robert Collins
  • Date: 2005-10-18 05:26:22 UTC
  • mto: This revision was merged to the branch mainline in revision 1463.
  • Revision ID: robertc@robertcollins.net-20051018052622-653d638c9e26fde4
fix broken tests

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
 
      - written to a stream
 
85
      - writen 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, repository, revision_id):
 
91
    def from_revision(cls, branch, revision_id):
92
92
        """Produce a new testament from a historical revision"""
93
 
        rev = repository.get_revision(revision_id)
94
 
        inventory = repository.get_inventory(revision_id)
 
93
        rev = branch.get_revision(revision_id)
 
94
        inventory = branch.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
 
        a = r.append
 
117
        def a(s):
 
118
            r.append(s)
118
119
        a('bazaar-ng testament version 1\n')
119
120
        a('revision-id: %s\n' % self.revision_id)
120
121
        a('committer: %s\n' % self.committer)
136
137
            for l in r:
137
138
                assert isinstance(l, basestring), \
138
139
                    '%r of type %s is not a plain string' % (l, type(l))
139
 
        return [line.encode('utf-8') for line in r]
 
140
        return r
140
141
 
141
142
    def _escape_path(self, path):
142
143
        assert not contains_linebreaks(path)