~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml6.py

Merge inventory serialisation tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
class Serializer_v6(xml5.Serializer_v5):
21
21
 
22
22
    format_num = '6'
 
23
    root_id = None
23
24
 
24
25
    def _append_inventory_root(self, append, inv):
25
26
        """Append the inventory root to output."""
26
 
        append('<inventory')
27
 
        append(' format="%s"' % self.format_num)
28
27
        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
 
28
            revid1 = ' revision_id="'
 
29
            revid2 = xml5._encode_and_escape(inv.revision_id)
 
30
        else:
 
31
            revid1 = ""
 
32
            revid2 = ""
 
33
        append('<inventory format="%s"%s%s>\n' % (
 
34
            self.format_num, revid1, revid2))
 
35
        append('<directory file_id="%s name="%s revision="%s />\n' % (
 
36
            xml5._encode_and_escape(inv.root.file_id),
 
37
            xml5._encode_and_escape(inv.root.name),
 
38
            xml5._encode_and_escape(inv.root.revision)))
36
39
 
37
40
    def _unpack_inventory(self, elt):
38
41
        """Construct from XML Element"""