~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/testament.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-03 20:18:35 UTC
  • mfrom: (1185.82.137 w-changeset)
  • Revision ID: pqm@pqm.ubuntu.com-20060603201835-1c9a1725641ccd24
Implement bundles

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
            assert ie.symlink_target
157
157
            l += ' ' + self._escape_path(ie.symlink_target)
158
158
        l += '\n'
159
 
        return l
 
159
        return l.decode('utf-8')
160
160
 
161
161
    def as_text(self):
162
162
        return ''.join(self.as_text_lines())
184
184
                    line = line.encode('utf-8')
185
185
                r.append('    %s\n' % line)
186
186
        return r
 
187
 
 
188
    def as_sha1(self):
 
189
        return sha(self.as_short_text()).hexdigest()
 
190
 
 
191
 
 
192
class StrictTestament(Testament):
 
193
    """This testament format is for use as a checksum in changesets"""
 
194
 
 
195
    def _entry_to_line(self, path, ie):
 
196
        l = ie.revision.decode('utf-8') + ' '
 
197
        l += {True: 'yes', False: 'no'}[ie.executable] + ' '
 
198
        l += Testament._entry_to_line(self, path, ie)
 
199
        return l
 
200
 
 
201
    def as_text_lines(self):
 
202
        lines = ['bazaar-ng testament version 2']
 
203
        lines.extend(Testament.as_text_lines(self)[1:])
 
204
        return lines