~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Aaron Bentley
  • Date: 2008-03-28 02:28:52 UTC
  • mto: This revision was merged to the branch mainline in revision 3371.
  • Revision ID: aaron@aaronbentley.com-20080328022852-fa7wsm7g7dhdr7b3
Handle format 5 revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
153
153
 
154
154
    supported_kinds = set(['file', 'directory', 'symlink'])
155
155
    format_num = '5'
 
156
    revision_format_num = None
156
157
 
157
158
    def _check_revisions(self, inv):
158
159
        """Extension point for subclasses to check during serialisation.
297
298
        revision_id = rev.revision_id
298
299
        if isinstance(revision_id, str):
299
300
            revision_id = decode_utf8(revision_id)
 
301
        format_num = self.format_num
 
302
        if self.revision_format_num is not None:
 
303
            format_num = self.revision_format_num
300
304
        root = Element('revision',
301
305
                       committer = rev.committer,
302
306
                       timestamp = '%.3f' % rev.timestamp,
303
307
                       revision_id = revision_id,
304
308
                       inventory_sha1 = rev.inventory_sha1,
305
 
                       format=self.format_num,
 
309
                       format=format_num,
306
310
                       )
307
311
        if rev.timezone is not None:
308
312
            root.set('timezone', str(rev.timezone))
404
408
        """XML Element -> Revision object"""
405
409
        assert elt.tag == 'revision'
406
410
        format = elt.get('format')
 
411
        format_num = self.format_num
 
412
        if self.revision_format_num is not None:
 
413
            format_num = self.revision_format_num
407
414
        if format is not None:
408
 
            if format != self.format_num:
409
 
                raise BzrError("invalid format version %r on inventory"
 
415
            if format != format_num:
 
416
                raise BzrError("invalid format version %r on revision"
410
417
                                % format)
411
418
        get_cached = _get_utf8_or_ascii
412
419
        rev = Revision(committer = elt.get('committer'),