/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 bzrlib/testament.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-20 14:51:03 UTC
  • mfrom: (0.8.23 version_info)
  • mto: This revision was merged to the branch mainline in revision 2028.
  • Revision ID: john@arbash-meinel.com-20060920145103-02725c6d6c886040
[merge] version-info plugin, and cleanup for layout in bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005 by Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
98
98
 
99
99
    def __init__(self, rev, inventory):
100
100
        """Create a new testament for rev using inventory."""
101
 
        self.revision_id = rev.revision_id
 
101
        self.revision_id = str(rev.revision_id)
102
102
        self.committer = rev.committer
103
103
        self.timezone = rev.timezone or 0
104
104
        self.timestamp = rev.timestamp
131
131
        for l in self.message.splitlines():
132
132
            a('  %s\n' % l)
133
133
        a('inventory:\n')
134
 
        for path, ie in self._get_entries():
 
134
        entries = self.inventory.iter_entries()
 
135
        entries.next()
 
136
        for path, ie in entries:
135
137
            a(self._entry_to_line(path, ie))
136
138
        r.extend(self._revprops_to_lines())
137
139
        if __debug__:
140
142
                    '%r of type %s is not a plain string' % (l, type(l))
141
143
        return [line.encode('utf-8') for line in r]
142
144
 
143
 
    def _get_entries(self):
144
 
        entries = self.inventory.iter_entries()
145
 
        entries.next()
146
 
        return entries
147
 
 
148
145
    def _escape_path(self, path):
149
146
        assert not contains_linebreaks(path)
150
147
        return unicode(path.replace('\\', '/').replace(' ', '\ '))
166
163
            content_spacer = ' '
167
164
 
168
165
        l = u'  %s %s %s%s%s\n' % (ie.kind, self._escape_path(path),
169
 
                                   ie.file_id.decode('utf8'),
 
166
                                   unicode(ie.file_id),
170
167
                                   content_spacer, content)
171
168
        return l
172
169
 
200
197
 
201
198
 
202
199
class StrictTestament(Testament):
203
 
    """This testament format is for use as a checksum in bundle format 0.8"""
 
200
    """This testament format is for use as a checksum in changesets"""
204
201
 
205
202
    long_header = 'bazaar-ng testament version 2.1\n'
206
203
    short_header = 'bazaar-ng testament short form 2.1\n'
209
206
        l += ' ' + ie.revision
210
207
        l += {True: ' yes\n', False: ' no\n'}[ie.executable]
211
208
        return l
212
 
 
213
 
 
214
 
class StrictTestament3(StrictTestament):
215
 
    """This testament format is for use as a checksum in bundle format 0.9+
216
 
    
217
 
    It differs from StrictTestament by including data about the tree root.
218
 
    """
219
 
 
220
 
    long_header = 'bazaar testament version 3 strict\n'
221
 
    short_header = 'bazaar testament short form 3 strict\n'
222
 
    def _get_entries(self):
223
 
        return self.inventory.iter_entries()
224
 
 
225
 
    def _escape_path(self, path):
226
 
        assert not contains_linebreaks(path)
227
 
        if path == '':
228
 
            path = '.'
229
 
        return unicode(path.replace('\\', '/').replace(' ', '\ '))