~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Patch Queue Manager
  • Date: 2012-02-07 00:57:24 UTC
  • mfrom: (6405.2.18 bzr)
  • Revision ID: pqm@pqm.ubuntu.com-20120207005724-xvfawh5exf1ohusu
(jelmer) Rename Tree.inventory to Tree.root_inventory. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
756
756
    def test_set_state_from_inventory_no_content_no_parents(self):
757
757
        # setting the current inventory is a slow but important api to support.
758
758
        tree1, revid1 = self.make_minimal_tree()
759
 
        inv = tree1.inventory
 
759
        inv = tree1.root_inventory
760
760
        root_id = inv.path2id('')
761
761
        expected_result = [], [
762
762
            (('', '', root_id), [
777
777
 
778
778
    def test_set_state_from_scratch_no_parents(self):
779
779
        tree1, revid1 = self.make_minimal_tree()
780
 
        inv = tree1.inventory
 
780
        inv = tree1.root_inventory
781
781
        root_id = inv.path2id('')
782
782
        expected_result = [], [
783
783
            (('', '', root_id), [
798
798
 
799
799
    def test_set_state_from_scratch_identical_parent(self):
800
800
        tree1, revid1 = self.make_minimal_tree()
801
 
        inv = tree1.inventory
 
801
        inv = tree1.root_inventory
802
802
        root_id = inv.path2id('')
803
803
        rev_tree1 = tree1.branch.repository.revision_tree(revid1)
804
804
        d_entry = ('d', '', 0, False, dirstate.DirState.NULLSTAT)
856
856
                tree._dirstate._get_entry(0, 'foo-id'))
857
857
 
858
858
            # extract the inventory, and add something to it
859
 
            inv = tree._get_inventory()
 
859
            inv = tree._get_root_inventory()
860
860
            # should see the file we poked in...
861
861
            self.assertTrue(inv.has_id('foo-id'))
862
862
            self.assertTrue(inv.has_filename('foo'))
892
892
                      ['a-id', 'b-id', 'a-b-id', 'foo-id', 'bar-id'])
893
893
            tree1.commit('rev1', rev_id='rev1')
894
894
            root_id = tree1.get_root_id()
895
 
            inv = tree1.inventory
 
895
            inv = tree1.root_inventory
896
896
        finally:
897
897
            tree1.unlock()
898
898
        expected_result1 = [('', '', root_id, 'd'),
1326
1326
        try:
1327
1327
            tree1.add(['b'], ['b-id'])
1328
1328
            root_id = tree1.get_root_id()
1329
 
            inv = tree1.inventory
 
1329
            inv = tree1.root_inventory
1330
1330
            state = dirstate.DirState.initialize('dirstate')
1331
1331
            try:
1332
1332
                # Set the initial state with 'b'
2527
2527
        basis_tree = self.create_tree_from_shape('basis', basis)
2528
2528
        target_tree = self.create_tree_from_shape('target', target)
2529
2529
        state = self.create_empty_dirstate()
2530
 
        state.set_state_from_scratch(active_tree.inventory,
 
2530
        state.set_state_from_scratch(active_tree.root_inventory,
2531
2531
            [('basis', basis_tree)], [])
2532
 
        delta = target_tree.inventory._make_delta(
2533
 
            basis_tree.inventory)
 
2532
        delta = target_tree.root_inventory._make_delta(
 
2533
            basis_tree.root_inventory)
2534
2534
        state.update_basis_by_delta(delta, 'target')
2535
2535
        state._validate()
2536
2536
        dirstate_tree = workingtree_4.DirStateRevisionTree(state,
2541
2541
        # And the dirblock state should be identical to the state if we created
2542
2542
        # it from scratch.
2543
2543
        state2 = self.create_empty_dirstate()
2544
 
        state2.set_state_from_scratch(active_tree.inventory,
 
2544
        state2.set_state_from_scratch(active_tree.root_inventory,
2545
2545
            [('target', target_tree)], [])
2546
2546
        self.assertEqual(state2._dirblocks, state._dirblocks)
2547
2547
        return state
2562
2562
        basis_tree = self.create_tree_from_shape('basis', basis)
2563
2563
        inv_delta = self.create_inv_delta(delta, 'target')
2564
2564
        state = self.create_empty_dirstate()
2565
 
        state.set_state_from_scratch(active_tree.inventory,
 
2565
        state.set_state_from_scratch(active_tree.root_inventory,
2566
2566
            [('basis', basis_tree)], [])
2567
2567
        self.assertRaises(errors.InconsistentDelta,
2568
2568
            state.update_basis_by_delta, inv_delta, 'target')