~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

- store revision properties in revision xml

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.errors import BzrError
23
23
 
24
24
 
25
 
 
26
 
 
27
 
 
28
25
class Serializer_v5(Serializer):
29
26
    """Version 5 serializer
30
27
 
99
96
                p = SubElement(pelts, 'revision_ref')
100
97
                p.tail = '\n'
101
98
                p.set('revision_id', parent_id)
 
99
        if rev.properties:
 
100
            self._pack_revision_properties(rev, root)
102
101
        return root
103
 
    
 
102
 
 
103
 
 
104
    def _pack_revision_properties(self, rev, under_element):
 
105
        top_elt = SubElement(under_element, 'properties')
 
106
        for prop_name, prop_value in sorted(rev.properties.items()):
 
107
            assert isinstance(prop_name, basestring) 
 
108
            assert isinstance(prop_value, basestring) 
 
109
            prop_elt = SubElement(top_elt, 'property')
 
110
            prop_elt.set('name', prop_name)
 
111
            prop_elt.text = prop_value
 
112
            prop_elt.tail = '\n'
 
113
        top_elt.tail = '\n'
 
114
 
104
115
 
105
116
    def _unpack_inventory(self, elt):
106
117
        """Construct from XML Element