~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_repository/test_commit_builder.py

MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
        if builder.record_root_entry is True:
50
50
            tree.lock_read()
51
51
            try:
52
 
                ie = tree.inventory.root
 
52
                ie = tree.root_inventory.root
53
53
            finally:
54
54
                tree.unlock()
55
55
            parent_tree = tree.branch.repository.revision_tree(
264
264
            if not builder.supports_record_entry_contents:
265
265
                raise tests.TestNotApplicable("CommitBuilder doesn't support "
266
266
                    "record_entry_contents")
267
 
            entry = tree.inventory['foo-id']
 
267
            entry = tree.root_inventory['foo-id']
268
268
            self.assertRaises(errors.RootMissing,
269
269
                builder.record_entry_contents, entry, [], 'foo', tree,
270
270
                    tree.path_content_summary('foo'))
288
288
            ie = inventory.make_entry('directory', '', None,
289
289
                    tree.get_root_id())
290
290
            delta, version_recorded, fs_hash = builder.record_entry_contents(
291
 
                ie, [parent_tree.inventory], '', tree,
 
291
                ie, [parent_tree.root_inventory], '', tree,
292
292
                tree.path_content_summary(''))
293
293
            # Regardless of repository root behaviour we should consider this a
294
294
            # pointless commit.
375
375
                if not builder.supports_record_entry_contents:
376
376
                    raise tests.TestNotApplicable("CommitBuilder doesn't "
377
377
                        "support record_entry_contents")
378
 
                parent_invs = [basis.inventory]
 
378
                parent_invs = [basis.root_inventory]
379
379
                builder.will_record_deletes()
380
380
                if builder.record_root_entry:
381
 
                    ie = basis.inventory.root.copy()
 
381
                    ie = basis.root_inventory.root.copy()
382
382
                    delta, _, _ = builder.record_entry_contents(ie, parent_invs,
383
383
                        '', tree, tree.path_content_summary(''))
384
384
                    if delta is not None:
435
435
                        "support record_entry_contents")
436
436
                builder.will_record_deletes()
437
437
                if builder.record_root_entry is True:
438
 
                    parent_invs = [basis.inventory]
439
 
                    del basis.inventory.root.children['foo']
440
 
                    builder.record_entry_contents(basis.inventory.root,
 
438
                    parent_invs = [basis.root_inventory]
 
439
                    del basis.root_inventory.root.children['foo']
 
440
                    builder.record_entry_contents(basis.root_inventory.root,
441
441
                        parent_invs, '', tree, tree.path_content_summary(''))
442
442
                # the delta should be returned, and recorded in _basis_delta
443
443
                delta = builder.record_delete("foo", "foo-id")
872
872
                parent_tree = tree.basis_tree()
873
873
                parent_tree.lock_read()
874
874
                self.addCleanup(parent_tree.unlock)
875
 
                parent_invs = [parent_tree.inventory]
 
875
                parent_invs = [parent_tree.root_inventory]
876
876
                for parent_id in parent_ids[1:]:
877
877
                    parent_invs.append(tree.branch.repository.revision_tree(
878
 
                        parent_id).inventory)
 
878
                        parent_id).root_inventory)
879
879
                # root
880
880
                builder.record_entry_contents(
881
881
                    inventory.make_entry('directory', '', None,
882
882
                        tree.get_root_id()), parent_invs, '', tree,
883
883
                        tree.path_content_summary(''))
884
884
                def commit_id(file_id):
885
 
                    old_ie = tree.inventory[file_id]
 
885
                    old_ie = tree.root_inventory[file_id]
886
886
                    path = tree.id2path(file_id)
887
887
                    ie = inventory.make_entry(tree.kind(file_id), old_ie.name,
888
888
                        old_ie.parent_id, file_id)
894
894
                        tree, content_summary)
895
895
 
896
896
                file_id = tree.path2id(new_name)
897
 
                parent_id = tree.inventory[file_id].parent_id
 
897
                parent_id = tree.root_inventory[file_id].parent_id
898
898
                if parent_id != tree.get_root_id():
899
899
                    commit_id(parent_id)
900
900
                # because a change of some sort is meant to have occurred,
999
999
            else:
1000
1000
                self.assertFalse(version_recorded)
1001
1001
 
1002
 
            new_inventory = builder.revision_tree().inventory
 
1002
            new_inventory = builder.revision_tree().root_inventory
1003
1003
            new_entry = new_inventory[file_id]
1004
1004
            if delta_against_basis:
1005
1005
                expected_delta = (name, new_name, file_id, new_entry)