488
488
def test_fetch_ghosts(self):
489
489
self.make_tree_and_repo()
490
490
self.tree.commit('first commit', rev_id=b'left-parent')
491
self.tree.add_parent_tree_id('ghost-parent')
492
fork = self.tree.controldir.sprout('fork', 'null:').open_workingtree()
491
self.tree.add_parent_tree_id(b'ghost-parent')
492
fork = self.tree.controldir.sprout('fork', b'null:').open_workingtree()
493
493
fork.commit('not a ghost', rev_id=b'not-ghost-parent')
494
494
self.tree.branch.repository.fetch(fork.branch.repository,
496
self.tree.add_parent_tree_id('not-ghost-parent')
496
self.tree.add_parent_tree_id(b'not-ghost-parent')
497
497
self.tree.commit('second commit', rev_id=b'second-id')
498
self.repo.fetch(self.tree.branch.repository, 'second-id')
498
self.repo.fetch(self.tree.branch.repository, b'second-id')
499
499
root_id = self.tree.get_root_id()
500
500
self.assertEqual(
501
((root_id, 'left-parent'), (root_id, 'not-ghost-parent')),
502
self.get_parents(root_id, 'second-id'))
501
((root_id, b'left-parent'), (root_id, b'not-ghost-parent')),
502
self.get_parents(root_id, b'second-id'))
504
504
def make_two_commits(self, change_root, fetch_twice):
505
505
self.make_tree_and_repo()
508
508
self.tree.set_root_id(b'unique-id')
509
509
self.tree.commit('second commit', rev_id=b'second-id')
511
self.repo.fetch(self.tree.branch.repository, 'first-id')
512
self.repo.fetch(self.tree.branch.repository, 'second-id')
511
self.repo.fetch(self.tree.branch.repository, b'first-id')
512
self.repo.fetch(self.tree.branch.repository, b'second-id')
514
514
def test_fetch_changed_root(self):
515
515
self.make_two_commits(change_root=True, fetch_twice=False)
516
self.assertEqual((), self.get_parents('unique-id', 'second-id'))
516
self.assertEqual((), self.get_parents(b'unique-id', b'second-id'))
518
518
def test_two_fetch_changed_root(self):
519
519
self.make_two_commits(change_root=True, fetch_twice=True)