~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Alexander Belchenko
  • Date: 2007-01-30 23:05:35 UTC
  • mto: This revision was merged to the branch mainline in revision 2259.
  • Revision ID: bialix@ukr.net-20070130230535-kx1rd478rtigyc3v
standalone installer: win98 support

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib.xml_serializer import ElementTree, SubElement, Element, Serializer
18
18
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
19
19
import bzrlib.inventory as inventory
20
 
from bzrlib.revision import Revision
 
20
from bzrlib.revision import Revision        
21
21
from bzrlib.errors import BzrError
22
22
 
23
23
 
24
24
class _Serializer_v4(Serializer):
25
25
    """Version 0.0.4 serializer
26
26
 
27
 
    You should use the serializer_v4 singleton.
28
 
    
29
 
    v4 serialisation is no longer supported, only deserialisation.
30
 
    """
 
27
    You should use the serializer_v4 singleton."""
31
28
    
32
29
    __slots__ = []
33
30
    
 
31
    def _pack_inventory(self, inv):
 
32
        """Convert to XML Element"""
 
33
        # v4 serialization is not used any more.
 
34
        raise NotImplementedError(self._pack_inventory)
 
35
        e = Element('inventory')
 
36
        e.text = '\n'
 
37
        if inv.root.file_id not in (None, ROOT_ID):
 
38
            e.set('file_id', inv.root.file_id)
 
39
        for path, ie in inv.iter_entries():
 
40
            e.append(self._pack_entry(ie))
 
41
        return e
 
42
 
 
43
 
34
44
    def _pack_entry(self, ie):
35
45
        """Convert InventoryEntry to XML element"""
36
46
        e = Element('entry')
58
68
        return e
59
69
 
60
70
 
61
 
    def _unpack_inventory(self, elt, revision_id=None):
 
71
    def _unpack_inventory(self, elt):
62
72
        """Construct from XML Element
63
 
 
64
 
        :param revision_id: Ignored parameter used by xml5.
65
73
        """
66
74
        assert elt.tag == 'inventory'
67
75
        root_id = elt.get('file_id') or ROOT_ID