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/',
1238
1236
self.assertRaises(errors.BzrError,
1239
1237
state.add, '..', 'ass-id', 'directory', None, None)
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'])
1249
tree1.add(['b'], ['b-id'])
1250
root_id = tree1.get_root_id()
1251
inv = tree1.inventory
1252
state = dirstate.DirState.initialize('dirstate')
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'),
1263
for entry in state._iter_entries():
1264
values.append(entry[0] + entry[1][0][:1])
1265
self.assertEqual(expected_result1, values)
1242
1272
class TestGetLines(TestCaseWithDirState):