1
from bzrlib import cache_utf8, inventory, errors, xml5
 
 
4
class Serializer_v6(xml5.Serializer_v5):
 
 
6
    def _append_inventory_root(self, append, inv):
 
 
7
        """Append the inventory root to output."""
 
 
10
        if inv.revision_id is not None:
 
 
11
            append(' revision_id="')
 
 
12
            append(xml5._encode_and_escape(inv.revision_id))
 
 
14
        self._append_entry(append, inv.root)
 
 
16
    def _parent_condition(self, ie):
 
 
17
        return ie.parent_id is not None
 
 
19
    def _unpack_inventory(self, elt):
 
 
20
        """Construct from XML Element"""
 
 
21
        if elt.tag != 'inventory':
 
 
22
            raise errors.UnexpectedInventoryFormat('Root tag is %r' % elt.tag)
 
 
23
        format = elt.get('format')
 
 
25
            raise errors.UnexpectedInventoryFormat('Invalid format version %r'
 
 
27
        revision_id = elt.get('revision_id')
 
 
28
        if revision_id is not None:
 
 
29
            revision_id = cache_utf8.get_cached_unicode(revision_id)
 
 
30
        inv = inventory.Inventory(root_id=None, revision_id=revision_id)
 
 
32
            ie = self._unpack_entry(e, none_parents=True)
 
 
37
serializer_v6 = Serializer_v6()