/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 object_store.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-14 13:52:10 UTC
  • mto: (0.200.1571 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20120214135210-r0972vn6u0suttd4
Pass tuples around for cache entries, rather than inventory entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
                try:
222
222
                    find_unchanged_parent_ie(file_id, kind[1], target, other_parent_trees)
223
223
                except KeyError:
224
 
                    yield path[1], blob, tree.root_inventory[file_id]
 
224
                    yield path[1], blob, (file_id, tree.get_file_revision(file_id, path[1]))
225
225
            new_trees[posixpath.dirname(path[1])] = parent[1]
226
226
        elif kind[1] not in (None, "directory"):
227
227
            raise AssertionError(kind[1])
236
236
        [(file_id, (path, file_id)) for (path, file_id) in new_blobs]):
237
237
        obj = Blob()
238
238
        obj.chunked = chunks
239
 
        yield path, obj, tree.root_inventory[file_id]
 
239
        yield path, obj, (file_id, tree.get_file_revision(file_id, path))
240
240
        shamap[file_id] = obj.id
241
241
 
242
242
    for path in unusual_modes:
279
279
                raise AssertionError
280
280
 
281
281
    for path in sorted(trees.keys(), reverse=True):
282
 
        ie = tree.root_inventory[trees[path]]
 
282
        file_id = trees[path]
 
283
        ie = tree.root_inventory[file_id]
283
284
        assert ie.kind == "directory"
284
285
        obj = directory_to_tree(ie, ie_to_hexsha, unusual_modes,
285
286
            dummy_file_name)
286
287
        if obj is not None:
287
 
            yield path, obj, ie
288
 
            shamap[ie.file_id] = obj.id
 
288
            yield path, obj, (file_id, )
 
289
            shamap[file_id] = obj.id
289
290
 
290
291
 
291
292
class PackTupleIterable(object):
420
421
        parent_trees = self.tree_cache.revision_trees(
421
422
            [p for p in rev.parent_ids if p in present_parents])
422
423
        root_tree = None
423
 
        for path, obj, ie in _tree_to_objects(tree, parent_trees,
 
424
        for path, obj, bzr_key_data in _tree_to_objects(tree, parent_trees,
424
425
                self._cache.idmap, unusual_modes, self.mapping.BZR_DUMMY_FILE):
425
426
            if path == "":
426
427
                root_tree = obj
427
 
                root_ie = ie
 
428
                root_key_data = bzr_key_data
428
429
                # Don't yield just yet
429
430
            else:
430
 
                yield path, obj, ie
 
431
                yield path, obj, bzr_key_data
431
432
        if root_tree is None:
432
433
            # Pointless commit - get the tree sha elsewhere
433
434
            if not rev.parent_ids:
435
436
            else:
436
437
                base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0])
437
438
                root_tree = self[self[base_sha1].tree]
438
 
            root_ie = tree.root_inventory.root
 
439
            root_key_data = (tree.get_root_id(), )
439
440
        if not lossy and self.mapping.BZR_FILE_IDS_FILE is not None:
440
441
            b = self._create_fileid_map_blob(tree)
441
442
            if b is not None:
442
443
                root_tree[self.mapping.BZR_FILE_IDS_FILE] = (
443
444
                    (stat.S_IFREG | 0644), b.id)
444
445
                yield self.mapping.BZR_FILE_IDS_FILE, b, None
445
 
        yield "", root_tree, root_ie
 
446
        yield "", root_tree, root_key_data
446
447
        if not lossy:
447
448
            testament3 = StrictTestament3(rev, tree)
448
449
            verifiers = { "testament3-sha1": testament3.as_sha1() }