/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/xml6.py

Merge bzr.dev.

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'
 
24
    root_id = None
23
25
 
24
26
    def _append_inventory_root(self, append, inv):
25
27
        """Append the inventory root to output."""
26
 
        append('<inventory')
27
 
        append(' format="%s"' % self.format_num)
28
28
        if inv.revision_id is not None:
29
 
            append(' revision_id="')
30
 
            append(xml5._encode_and_escape(inv.revision_id))
31
 
        append('>\n')
32
 
        self._append_entry(append, inv.root)
33
 
 
34
 
    def _parent_condition(self, ie):
35
 
        return ie.parent_id is not None
36
 
 
37
 
    def _unpack_inventory(self, elt):
 
29
            revid1 = ' revision_id="'
 
30
            revid2 = xml5._encode_and_escape(inv.revision_id)
 
31
        else:
 
32
            revid1 = ""
 
33
            revid2 = ""
 
34
        append('<inventory format="%s"%s%s>\n' % (
 
35
            self.format_num, revid1, revid2))
 
36
        append('<directory file_id="%s name="%s revision="%s />\n' % (
 
37
            xml5._encode_and_escape(inv.root.file_id),
 
38
            xml5._encode_and_escape(inv.root.name),
 
39
            xml5._encode_and_escape(inv.root.revision)))
 
40
 
 
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):
38
53
        """Construct from XML Element"""
39
54
        if elt.tag != 'inventory':
40
55
            raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag)
49
64
        for e in elt:
50
65
            ie = self._unpack_entry(e)
51
66
            inv.add(ie)
 
67
        assert inv.root.revision is not None
52
68
        return inv
53
69
 
54
70