688
688
# This will unlock it
689
689
self.check_state_with_reopen(expected_result, state)
691
def test_set_state_from_inventory_mixed_paths(self):
692
tree1 = self.make_branch_and_tree('tree1')
693
self.build_tree(['tree1/a/', 'tree1/a/b/', 'tree1/a-b/',
694
'tree1/a/b/foo', 'tree1/a-b/bar'])
697
tree1.add(['a', 'a/b', 'a-b', 'a/b/foo', 'a-b/bar'],
698
['a-id', 'b-id', 'a-b-id', 'foo-id', 'bar-id'])
699
tree1.commit('rev1', rev_id='rev1')
700
root_id = tree1.get_root_id()
701
inv = tree1.inventory
704
expected_result1 = [('', '', root_id, 'd'),
705
('', 'a', 'a-id', 'd'),
706
('', 'a-b', 'a-b-id', 'd'),
707
('a', 'b', 'b-id', 'd'),
708
('a/b', 'foo', 'foo-id', 'f'),
709
('a-b', 'bar', 'bar-id', 'f'),
711
expected_result2 = [('', '', root_id, 'd'),
712
('', 'a', 'a-id', 'd'),
713
('', 'a-b', 'a-b-id', 'd'),
714
('a-b', 'bar', 'bar-id', 'f'),
716
state = dirstate.DirState.initialize('dirstate')
718
state.set_state_from_inventory(inv)
720
for entry in state._iter_entries():
721
values.append(entry[0] + entry[1][0][:1])
722
self.assertEqual(expected_result1, values)
724
state.set_state_from_inventory(inv)
726
for entry in state._iter_entries():
727
values.append(entry[0] + entry[1][0][:1])
728
self.assertEqual(expected_result2, values)
691
732
def test_set_path_id_no_parents(self):
692
733
"""The id of a path can be changed trivally with no parents."""
693
734
state = dirstate.DirState.initialize('dirstate')