427
def test_set_path_id_with_parents(self):
428
"""Set the root file id in a dirstate with parents"""
429
mt = self.make_branch_and_tree('mt')
430
# may need to set the root when the default format is one where it's
432
mt.commit('foo', rev_id='parent-revid')
433
rt = mt.branch.repository.revision_tree('parent-revid')
434
state = dirstate.DirState.initialize('dirstate')
436
state.set_parent_trees([('parent-revid', rt)], ghosts=[])
437
state.set_path_id('', 'foobarbaz')
438
# now see that it is what we expected
440
(('', '', 'TREE_ROOT'),
441
[('a', '', 0, False, ''),
442
('d', '', 0, False, 'parent-revid'),
444
(('', '', 'foobarbaz'),
445
[('d', '', 0, False, ''),
446
('a', '', 0, False, ''),
449
self.assertEqual(expected_rows, list(state._iter_entries()))
450
# should work across save too
454
# now flush & check we get the same
455
state = dirstate.DirState.on_file('dirstate')
458
self.assertEqual(expected_rows, list(state._iter_entries()))
427
462
def test_set_parent_trees_no_content(self):
428
463
# set_parent_trees is a slow but important api to support.
429
464
tree1 = self.make_branch_and_memory_tree('tree1')