~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml.py

  • Committer: Martin Pool
  • Date: 2005-09-06 06:44:11 UTC
  • Revision ID: mbp@sourcefrog.net-20050906064410-86f1113d1d1ee429
- fix v5 packing of inventory entries

  add test for round-trip on inventory entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
222
222
class _Serializer_v5(Serializer):
223
223
    """Version 5 serializer
224
224
 
 
225
    Packs objects into XML and vice versa.
 
226
 
225
227
    You should use the serialzer_v5 singleton."""
226
228
    
227
229
    __slots__ = []
239
241
 
240
242
    def _pack_entry(self, ie):
241
243
        """Convert InventoryEntry to XML element"""
242
 
        e = Element('entry')
 
244
        assert ie.kind == 'directory' or ie.kind == 'file'
 
245
        e = Element(ie.kind)
243
246
        e.set('name', ie.name)
244
247
        e.set('file_id', ie.file_id)
245
 
        e.set('kind', ie.kind)
246
248
 
247
249
        if ie.text_size != None:
248
250
            e.set('text_size', '%d' % ie.text_size)