/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/xml5.py

mergeĀ fromĀ dirstate

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
        """
282
282
        assert elt.tag == 'inventory'
283
283
        root_id = elt.get('file_id') or ROOT_ID
 
284
        root_id = _get_utf8_or_ascii(root_id)
 
285
 
284
286
        format = elt.get('format')
285
287
        if format is not None:
286
288
            if format != '5':
292
294
        inv = Inventory(root_id, revision_id=revision_id)
293
295
        for e in elt:
294
296
            ie = self._unpack_entry(e)
295
 
            if ie.parent_id == ROOT_ID:
 
297
            if ie.parent_id is None:
296
298
                ie.parent_id = root_id
297
299
            inv.add(ie)
298
300
        return inv
299
301
 
300
 
    def _unpack_entry(self, elt, none_parents=False):
 
302
    def _unpack_entry(self, elt):
301
303
        kind = elt.tag
302
304
        if not InventoryEntry.versionable_kind(kind):
303
305
            raise AssertionError('unsupported entry kind %s' % kind)
305
307
        get_cached = _get_utf8_or_ascii
306
308
 
307
309
        parent_id = elt.get('parent_id')
308
 
        if parent_id is None and not none_parents:
309
 
            parent_id = ROOT_ID
310
 
        # TODO: jam 20060817 At present, caching file ids costs us too 
311
 
        #       much time. It slows down overall read performances from
312
 
        #       approx 500ms to 700ms. And doesn't improve future reads.
313
 
        #       it might be because revision ids and file ids are mixing.
314
 
        #       Consider caching *just* the file ids, for a limited period
315
 
        #       of time.
316
 
        #parent_id = get_cached(parent_id)
317
 
        #file_id = get_cached(elt.get('file_id'))
318
 
        file_id = elt.get('file_id')
 
310
        if parent_id is not None:
 
311
            parent_id = get_cached(parent_id)
 
312
        file_id = get_cached(elt.get('file_id'))
319
313
 
320
314
        if kind == 'directory':
321
315
            ie = inventory.InventoryDirectory(file_id,