602
602
self.make_two_commits(change_root=False, fetch_twice=True)
603
603
self.assertEqual((('TREE_ROOT', 'first-id'),),
604
604
self.get_parents('TREE_ROOT', 'second-id'))
607
class TestGCCHKToGCCHKFetch(TestCaseWithTransport):
609
def test_simple_fetch(self):
610
builder = self.make_branch_builder('source', format='gc-chk255-big')
611
builder.start_series()
613
builder.build_snapshot('A', None, [
614
('add', ('', 'TREE_ROOT', 'directory', None))])
615
builder.build_snapshot('B', ['A'], [
616
('add', ('foo', 'foo-id', 'file', 'foo content\n'))])
617
builder.build_snapshot('C', ['B'], [
618
('add', ('bar', 'bar-id', 'file', 'bar content\n'))])
620
builder.finish_series()
621
source_branch = builder.get_branch()
623
target_branch = self.make_branch('target', format='gc-chk255-big')
624
target_branch.lock_write()
625
self.addCleanup(target_branch.unlock)
626
target = target_branch.repository
627
target.fetch(source_branch.repository, 'B')
628
self.assertEqual({'B': ('A',)}, target.get_parent_map(['B', 'C']))
629
target.fetch(source_branch.repository, 'C')
630
self.assertEqual({'B': ('A',), 'C': ('B',)},
631
target.get_parent_map(['B', 'C']))