~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml4.py

  • Committer: Martin Pool
  • Date: 2005-09-19 07:52:30 UTC
  • Revision ID: mbp@sourcefrog.net-20050919075230-bd8a133ef1671044
- remove RevisionReference; just hold parent ids directly

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
 
129
129
        if rev.parents:
130
130
            pelts = SubElement(root, 'parents')
131
131
            pelts.tail = pelts.text = '\n'
132
 
            for rr in rev.parents:
133
 
                assert isinstance(rr, RevisionReference)
 
132
            for i, parent_id in enumerate(rev.parents):
134
133
                p = SubElement(pelts, 'revision_ref')
135
134
                p.tail = '\n'
136
 
                assert rr.revision_id
137
 
                p.set('revision_id', rr.revision_id)
138
 
                if rr.revision_sha1:
139
 
                    p.set('revision_sha1', rr.revision_sha1)
140
 
 
 
135
                assert parent_id
 
136
                p.set('revision_id', parent_id)
 
137
                if i < len(rev.parent_sha1s):
 
138
                    p.set('revision_sha1', rev.parent_sha1s[i])
141
139
        return root
142
140
 
143
141
    
164
162
            for p in pelts:
165
163
                assert p.tag == 'revision_ref', \
166
164
                       "bad parent node tag %r" % p.tag
167
 
                rev_ref = RevisionReference(p.get('revision_id'),
168
 
                                            p.get('revision_sha1'))
169
 
                rev.parents.append(rev_ref)
170
 
 
 
165
                rev.parents.append(p.get('revision_id'))
 
166
                rev.parent_sha1s.append(p.get('revision_sha1'))
171
167
            if precursor:
172
168
                # must be consistent
173
169
                prec_parent = rev.parents[0].revision_id
175
171
        elif precursor:
176
172
            # revisions written prior to 0.0.5 have a single precursor
177
173
            # give as an attribute
178
 
            rev_ref = RevisionReference(precursor, precursor_sha1)
179
 
            rev.parents.append(rev_ref)
 
174
            rev.parents.append(precursor)
 
175
            rev.parent_sha1s.append(precursor_sha1)
180
176
 
181
177
        v = elt.get('timezone')
182
178
        rev.timezone = v and int(v)