~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

- properties are retrieved when revisions are loaded

- test for this

Show diffs side-by-side

added added

removed removed

Lines of Context:
184
184
            assert p.tag == 'revision_ref', \
185
185
                   "bad parent node tag %r" % p.tag
186
186
            rev.parent_ids.append(p.get('revision_id'))
187
 
 
 
187
        self._unpack_revision_properties(elt, rev)
188
188
        v = elt.get('timezone')
189
189
        rev.timezone = v and int(v)
190
 
 
191
190
        rev.message = elt.findtext('message') # text of <message>
192
191
        return rev
193
192
 
194
193
 
 
194
    def _unpack_revision_properties(self, elt, rev):
 
195
        """Unpack properties onto a revision."""
 
196
        props_elt = elt.find('properties')
 
197
        assert len(rev.properties) == 0
 
198
        if not props_elt:
 
199
            return
 
200
        for prop_elt in props_elt:
 
201
            assert prop_elt.tag == 'property', \
 
202
                "bad tag under properties list: %r" % p.tag
 
203
            name = prop_elt.get('name')
 
204
            value = prop_elt.text
 
205
            assert name not in rev.properties, \
 
206
                "repeated property %r" % p.name
 
207
            rev.properties[name] = value
 
208
 
 
209
 
195
210
serializer_v5 = Serializer_v5()