~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Robert Collins
  • Date: 2005-09-28 09:35:50 UTC
  • mfrom: (1185.1.47)
  • Revision ID: robertc@robertcollins.net-20050928093550-3ca194dfaffc79f1
merge from integration

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from bzrlib.xml import ElementTree, SubElement, Element, Serializer
19
19
from bzrlib.inventory import ROOT_ID, Inventory, InventoryEntry
20
 
from bzrlib.revision import Revision, RevisionReference        
 
20
from bzrlib.revision import Revision        
21
21
from bzrlib.errors import BzrError
22
22
 
23
23
 
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', 'entry_version']:
 
56
        for f in ['text_version', 'text_sha1', 'name_version']:
57
57
            v = getattr(ie, f)
58
58
            if v != None:
59
59
                e.set(f, v)
86
86
        msg.text = rev.message
87
87
        msg.tail = '\n'
88
88
 
89
 
        if rev.parents:
 
89
        if rev.parent_ids:
90
90
            pelts = SubElement(root, 'parents')
91
91
            pelts.tail = pelts.text = '\n'
92
 
            for rr in rev.parents:
93
 
                assert isinstance(rr, RevisionReference)
 
92
            for parent_id in rev.parent_ids:
 
93
                assert isinstance(parent_id, basestring)
94
94
                p = SubElement(pelts, 'revision_ref')
95
95
                p.tail = '\n'
96
 
                assert rr.revision_id
97
 
                p.set('revision_id', rr.revision_id)
98
 
 
 
96
                p.set('revision_id', parent_id)
99
97
        return root
100
98
 
101
99
    
116
114
 
117
115
    def _unpack_entry(self, elt):
118
116
        kind = elt.tag
119
 
        assert kind == 'directory' or kind == 'file'
 
117
        assert kind == 'directory' or kind == 'file', \
 
118
            'unsupported entry kind %s' % kind
120
119
 
121
120
        parent_id = elt.get('parent_id')
122
121
        if parent_id == None:
127
126
                            kind,
128
127
                            parent_id)
129
128
        ie.text_version = elt.get('text_version')
130
 
        ie.entry_version = elt.get('entry_version')
 
129
        ie.name_version = elt.get('name_version')
131
130
        ie.text_sha1 = elt.get('text_sha1')
132
131
        v = elt.get('text_size')
133
132
        ie.text_size = v and int(v)
149
148
        for p in parents:
150
149
            assert p.tag == 'revision_ref', \
151
150
                   "bad parent node tag %r" % p.tag
152
 
            rev_ref = RevisionReference(p.get('revision_id'))
153
 
            rev.parents.append(rev_ref)
 
151
            rev.parent_ids.append(p.get('revision_id'))
154
152
 
155
153
        v = elt.get('timezone')
156
154
        rev.timezone = v and int(v)