~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

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'
2210
2210
class TestDirstateTreeReference(TestCaseWithDirState):
2211
2211
 
2212
2212
    def test_reference_revision_is_none(self):
2213
 
        tree = self.make_branch_and_tree('tree', format='dirstate-with-subtree')
 
2213
        tree = self.make_branch_and_tree('tree', format='development-subtree')
2214
2214
        subtree = self.make_branch_and_tree('tree/subtree',
2215
 
                            format='dirstate-with-subtree')
 
2215
                            format='development-subtree')
2216
2216
        subtree.set_root_id('subtree')
2217
2217
        tree.add_reference(subtree)
2218
2218
        tree.add('subtree')
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(basis_tree.inventory)
 
2532
        delta = target_tree.root_inventory._make_delta(
 
2533
            basis_tree.root_inventory)
2533
2534
        state.update_basis_by_delta(delta, 'target')
2534
2535
        state._validate()
2535
2536
        dirstate_tree = workingtree_4.DirStateRevisionTree(state,
2540
2541
        # And the dirblock state should be identical to the state if we created
2541
2542
        # it from scratch.
2542
2543
        state2 = self.create_empty_dirstate()
2543
 
        state2.set_state_from_scratch(active_tree.inventory,
 
2544
        state2.set_state_from_scratch(active_tree.root_inventory,
2544
2545
            [('target', target_tree)], [])
2545
2546
        self.assertEqual(state2._dirblocks, state._dirblocks)
2546
2547
        return state
2561
2562
        basis_tree = self.create_tree_from_shape('basis', basis)
2562
2563
        inv_delta = self.create_inv_delta(delta, 'target')
2563
2564
        state = self.create_empty_dirstate()
2564
 
        state.set_state_from_scratch(active_tree.inventory,
 
2565
        state.set_state_from_scratch(active_tree.root_inventory,
2565
2566
            [('basis', basis_tree)], [])
2566
2567
        self.assertRaises(errors.InconsistentDelta,
2567
2568
            state.update_basis_by_delta, inv_delta, 'target')