~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_dirstate.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-24 18:26:21 UTC
  • mfrom: (4567 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4568.
  • Revision ID: john@arbash-meinel.com-20090724182621-68s2jhoqf3pn72n7
Merge bzr.dev 4567 to resolve NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
827
827
        finally:
828
828
            tree.unlock()
829
829
 
830
 
 
831
830
    def test_set_state_from_inventory_mixed_paths(self):
832
831
        tree1 = self.make_branch_and_tree('tree1')
833
832
        self.build_tree(['tree1/a/', 'tree1/a/b/', 'tree1/a-b/',
942
941
        finally:
943
942
            state.unlock()
944
943
 
945
 
 
946
944
    def test_set_parent_trees_no_content(self):
947
945
        # set_parent_trees is a slow but important api to support.
948
946
        tree1 = self.make_branch_and_memory_tree('tree1')
1238
1236
        self.assertRaises(errors.BzrError,
1239
1237
            state.add, '..', 'ass-id', 'directory', None, None)
1240
1238
 
 
1239
    def test_set_state_with_rename_b_a_bug_395556(self):
 
1240
        # bug 395556 uncovered a bug where the dirstate ends up with a false
 
1241
        # relocation record - in a tree with no parents there should be no
 
1242
        # absent or relocated records. This then leads to further corruption
 
1243
        # when a commit occurs, as the incorrect relocation gathers an
 
1244
        # incorrect absent in tree 1, and future changes go to pot.
 
1245
        tree1 = self.make_branch_and_tree('tree1')
 
1246
        self.build_tree(['tree1/b'])
 
1247
        tree1.lock_write()
 
1248
        try:
 
1249
            tree1.add(['b'], ['b-id'])
 
1250
            root_id = tree1.get_root_id()
 
1251
            inv = tree1.inventory
 
1252
            state = dirstate.DirState.initialize('dirstate')
 
1253
            try:
 
1254
                # Set the initial state with 'b'
 
1255
                state.set_state_from_inventory(inv)
 
1256
                inv.rename('b-id', root_id, 'a')
 
1257
                # Set the new state with 'a', which currently corrupts.
 
1258
                state.set_state_from_inventory(inv)
 
1259
                expected_result1 = [('', '', root_id, 'd'),
 
1260
                                    ('', 'a', 'b-id', 'f'),
 
1261
                                   ]
 
1262
                values = []
 
1263
                for entry in state._iter_entries():
 
1264
                    values.append(entry[0] + entry[1][0][:1])
 
1265
                self.assertEqual(expected_result1, values)
 
1266
            finally:
 
1267
                state.unlock()
 
1268
        finally:
 
1269
            tree1.unlock()
 
1270
 
1241
1271
 
1242
1272
class TestGetLines(TestCaseWithDirState):
1243
1273