~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: Aaron Bentley
  • Date: 2006-08-23 04:25:06 UTC
  • mto: (1910.2.43 format-bumps)
  • mto: This revision was merged to the branch mainline in revision 1997.
  • Revision ID: aaron.bentley@utoronto.ca-20060823042506-98adf009e8bd90d1
Make commits preserve root entry data

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
        append(_encode_and_escape(ie.file_id))
151
151
        append(' name="')
152
152
        append(_encode_and_escape(ie.name))
153
 
        if ie.parent_id != ROOT_ID:
 
153
        if self._parent_condition(ie):
154
154
            assert isinstance(ie.parent_id, basestring)
155
155
            append(' parent_id="')
156
156
            append(_encode_and_escape(ie.parent_id))
169
169
        append(" />\n")
170
170
        return
171
171
 
 
172
    def _parent_condition(self, ie):
 
173
        return ie.parent_id != ROOT_ID
 
174
 
172
175
    def _pack_revision(self, rev):
173
176
        """Revision object -> xml tree"""
174
177
        root = Element('revision',
228
231
            inv.add(ie)
229
232
        return inv
230
233
 
231
 
    def _unpack_entry(self, elt):
 
234
    def _unpack_entry(self, elt, none_parents=False):
232
235
        kind = elt.tag
233
236
        if not InventoryEntry.versionable_kind(kind):
234
237
            raise AssertionError('unsupported entry kind %s' % kind)
236
239
        get_cached = cache_utf8.get_cached_unicode
237
240
 
238
241
        parent_id = elt.get('parent_id')
239
 
        if parent_id == None:
 
242
        if parent_id == None and not none_parents:
240
243
            parent_id = ROOT_ID
241
244
        # TODO: jam 20060817 At present, caching file ids costs us too 
242
245
        #       much time. It slows down overall read performances from