~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Robert Collins
  • Date: 2005-10-03 01:15:02 UTC
  • mfrom: (1092.2.28)
  • Revision ID: robertc@robertcollins.net-20051003011502-f579a509a136b774
mergeĀ fromĀ baz2bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
    def _pack_entry(self, ie):
47
47
        """Convert InventoryEntry to XML element"""
48
 
        assert ie.kind == 'directory' or ie.kind == 'file'
 
48
        assert ie.kind in ('directory', 'file', 'symlink')
49
49
        e = Element(ie.kind)
50
50
        e.set('name', ie.name)
51
51
        e.set('file_id', ie.file_id)
53
53
        if ie.text_size != None:
54
54
            e.set('text_size', '%d' % ie.text_size)
55
55
 
56
 
        for f in ['text_version', 'text_sha1', 'name_version']:
 
56
        for f in ['text_sha1', 'revision', 'symlink_target']:
57
57
            v = getattr(ie, f)
58
58
            if v != None:
59
59
                e.set(f, v)
114
114
 
115
115
    def _unpack_entry(self, elt):
116
116
        kind = elt.tag
117
 
        assert kind == 'directory' or kind == 'file', \
118
 
            'unsupported entry kind %s' % kind
 
117
        if not kind in ('directory', 'file', 'symlink'):
 
118
            raise AssertionError('unsupported entry kind %s' % kind)
119
119
 
120
120
        parent_id = elt.get('parent_id')
121
121
        if parent_id == None:
125
125
                            elt.get('name'),
126
126
                            kind,
127
127
                            parent_id)
128
 
        ie.text_version = elt.get('text_version')
129
 
        ie.name_version = elt.get('name_version')
 
128
        ie.revision = elt.get('revision')
130
129
        ie.text_sha1 = elt.get('text_sha1')
 
130
        ie.symlink_target = elt.get('symlink_target')
131
131
        v = elt.get('text_size')
132
132
        ie.text_size = v and int(v)
133
133