~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: Shannon Weyrick
  • Date: 2011-11-16 20:59:10 UTC
  • mto: This revision was merged to the branch mainline in revision 6268.
  • Revision ID: weyrick@mozek.us-20111116205910-1xbpqbimbw3fvfqw
A version of the patch, based on suggestions from John Meinel, which detects an empty page differently to avoid false positives.

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.root_inventory
 
759
        inv = tree1.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.root_inventory
 
780
        inv = tree1.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.root_inventory
 
801
        inv = tree1.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_root_inventory()
 
859
            inv = tree._get_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.root_inventory
 
895
            inv = tree1.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.root_inventory
 
1329
            inv = tree1.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='development-subtree')
 
2213
        tree = self.make_branch_and_tree('tree', format='dirstate-with-subtree')
2214
2214
        subtree = self.make_branch_and_tree('tree/subtree',
2215
 
                            format='development-subtree')
 
2215
                            format='dirstate-with-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.root_inventory,
 
2530
        state.set_state_from_scratch(active_tree.inventory,
2531
2531
            [('basis', basis_tree)], [])
2532
 
        delta = target_tree.root_inventory._make_delta(
2533
 
            basis_tree.root_inventory)
 
2532
        delta = target_tree.inventory._make_delta(basis_tree.inventory)
2534
2533
        state.update_basis_by_delta(delta, 'target')
2535
2534
        state._validate()
2536
2535
        dirstate_tree = workingtree_4.DirStateRevisionTree(state,
2541
2540
        # And the dirblock state should be identical to the state if we created
2542
2541
        # it from scratch.
2543
2542
        state2 = self.create_empty_dirstate()
2544
 
        state2.set_state_from_scratch(active_tree.root_inventory,
 
2543
        state2.set_state_from_scratch(active_tree.inventory,
2545
2544
            [('target', target_tree)], [])
2546
2545
        self.assertEqual(state2._dirblocks, state._dirblocks)
2547
2546
        return state
2562
2561
        basis_tree = self.create_tree_from_shape('basis', basis)
2563
2562
        inv_delta = self.create_inv_delta(delta, 'target')
2564
2563
        state = self.create_empty_dirstate()
2565
 
        state.set_state_from_scratch(active_tree.root_inventory,
 
2564
        state.set_state_from_scratch(active_tree.inventory,
2566
2565
            [('basis', basis_tree)], [])
2567
2566
        self.assertRaises(errors.InconsistentDelta,
2568
2567
            state.update_basis_by_delta, inv_delta, 'target')