~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml6.py

  • Committer: Martin Pool
  • Date: 2007-10-10 00:21:57 UTC
  • mfrom: (2900 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071010002157-utci0x44m2w47wgd
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
 
20
20
class Serializer_v6(xml5.Serializer_v5):
 
21
    """This serialiser adds rich roots."""
21
22
 
22
23
    format_num = '6'
23
24
    root_id = None
37
38
            xml5._encode_and_escape(inv.root.name),
38
39
            xml5._encode_and_escape(inv.root.revision)))
39
40
 
40
 
    def _unpack_inventory(self, elt):
 
41
    def _check_revisions(self, inv):
 
42
        """Extension point for subclasses to check during serialisation.
 
43
 
 
44
        By default no checking is done.
 
45
 
 
46
        :param inv: An inventory about to be serialised, to be checked.
 
47
        :raises: AssertionError if an error has occured.
 
48
        """
 
49
        assert inv.revision_id is not None
 
50
        assert inv.root.revision is not None
 
51
 
 
52
    def _unpack_inventory(self, elt, revision_id=None):
41
53
        """Construct from XML Element"""
42
54
        if elt.tag != 'inventory':
43
55
            raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag)
52
64
        for e in elt:
53
65
            ie = self._unpack_entry(e)
54
66
            inv.add(ie)
 
67
        assert inv.root.revision is not None
55
68
        return inv
56
69
 
57
70