~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

  • Committer: John Arbash Meinel
  • Date: 2007-02-17 22:25:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2298.
  • Revision ID: john@arbash-meinel.com-20070217222537-p0hxseinc3x84e96
Minor performance improvement, use None as signal rather than ROOT_ID
for xml5 inventories. Discover small bug in serialized text because of this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
286
286
        inv = Inventory(root_id, revision_id=revision_id)
287
287
        for e in elt:
288
288
            ie = self._unpack_entry(e)
289
 
            if ie.parent_id == ROOT_ID:
 
289
            if ie.parent_id is None:
290
290
                ie.parent_id = root_id
291
291
            inv.add(ie)
292
292
        return inv
293
293
 
294
 
    def _unpack_entry(self, elt, none_parents=False):
 
294
    def _unpack_entry(self, elt):
295
295
        kind = elt.tag
296
296
        if not InventoryEntry.versionable_kind(kind):
297
297
            raise AssertionError('unsupported entry kind %s' % kind)
299
299
        get_cached = _get_utf8_or_ascii
300
300
 
301
301
        parent_id = elt.get('parent_id')
302
 
        if parent_id is None and not none_parents:
303
 
            parent_id = ROOT_ID
304
302
        # TODO: jam 20060817 At present, caching file ids costs us too 
305
303
        #       much time. It slows down overall read performances from
306
304
        #       approx 500ms to 700ms. And doesn't improve future reads.