555
class TestSmartServerBranching(tests.TestCaseWithTransport):
557
def test_branch_from_trivial_branch_to_same_server_branch_acceptance(self):
558
self.setup_smart_server_with_call_log()
559
t = self.make_branch_and_tree('from')
560
for count in range(9):
561
t.commit(message='commit %d' % count)
562
self.reset_smart_call_log()
563
out, err = self.run_bzr(['branch', self.get_url('from'),
564
self.get_url('target')])
565
# This figure represent the amount of work to perform this use case. It
566
# is entirely ok to reduce this number if a test fails due to rpc_count
567
# being too low. If rpc_count increases, more network roundtrips have
568
# become necessary for this use case. Please do not adjust this number
569
# upwards without agreement from bzr's network support maintainers.
570
self.assertLength(2, self.hpss_connections)
571
self.assertLength(34, self.hpss_calls)
573
"branching to the same branch requires VFS access",
574
self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
576
def test_branch_from_trivial_branch_streaming_acceptance(self):
577
self.setup_smart_server_with_call_log()
578
t = self.make_branch_and_tree('from')
579
for count in range(9):
580
t.commit(message='commit %d' % count)
581
self.reset_smart_call_log()
582
out, err = self.run_bzr(['branch', self.get_url('from'),
584
# This figure represent the amount of work to perform this use case. It
585
# is entirely ok to reduce this number if a test fails due to rpc_count
586
# being too low. If rpc_count increases, more network roundtrips have
587
# become necessary for this use case. Please do not adjust this number
588
# upwards without agreement from bzr's network support maintainers.
589
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
590
self.assertLength(11, self.hpss_calls)
591
self.assertLength(1, self.hpss_connections)
593
def test_branch_from_trivial_stacked_branch_streaming_acceptance(self):
594
self.setup_smart_server_with_call_log()
595
t = self.make_branch_and_tree('trunk')
596
for count in range(8):
597
t.commit(message='commit %d' % count)
598
tree2 = t.branch.controldir.sprout('feature', stacked=True
600
local_tree = t.branch.controldir.sprout(
601
'local-working').open_workingtree()
602
local_tree.commit('feature change')
603
local_tree.branch.push(tree2.branch)
604
self.reset_smart_call_log()
605
out, err = self.run_bzr(['branch', self.get_url('feature'),
607
# This figure represent the amount of work to perform this use case. It
608
# is entirely ok to reduce this number if a test fails due to rpc_count
609
# being too low. If rpc_count increases, more network roundtrips have
610
# become necessary for this use case. Please do not adjust this number
611
# upwards without agreement from bzr's network support maintainers.
612
self.assertLength(16, self.hpss_calls)
613
self.assertLength(1, self.hpss_connections)
614
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
616
def test_branch_from_branch_with_tags(self):
617
self.setup_smart_server_with_call_log()
618
builder = self.make_branch_builder('source')
619
source, rev1, rev2 = fixtures.build_branch_with_non_ancestral_rev(
621
source.get_config_stack().set('branch.fetch_tags', True)
622
source.tags.set_tag('tag-a', rev2)
623
source.tags.set_tag('tag-missing', b'missing-rev')
624
# Now source has a tag not in its ancestry. Make a branch from it.
625
self.reset_smart_call_log()
626
out, err = self.run_bzr(['branch', self.get_url('source'), 'target'])
627
# This figure represent the amount of work to perform this use case. It
628
# is entirely ok to reduce this number if a test fails due to rpc_count
629
# being too low. If rpc_count increases, more network roundtrips have
630
# become necessary for this use case. Please do not adjust this number
631
# upwards without agreement from bzr's network support maintainers.
632
self.assertLength(11, self.hpss_calls)
633
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
634
self.assertLength(1, self.hpss_connections)
636
def test_branch_to_stacked_from_trivial_branch_streaming_acceptance(self):
637
self.setup_smart_server_with_call_log()
638
t = self.make_branch_and_tree('from')
639
for count in range(9):
640
t.commit(message='commit %d' % count)
641
self.reset_smart_call_log()
642
out, err = self.run_bzr(['branch', '--stacked', self.get_url('from'),
644
# XXX: the number of hpss calls for this case isn't deterministic yet,
645
# so we can't easily assert about the number of calls.
646
#self.assertLength(XXX, self.hpss_calls)
647
# We can assert that none of the calls were readv requests for rix
648
# files, though (demonstrating that at least get_parent_map calls are
649
# not using VFS RPCs).
650
readvs_of_rix_files = [
651
c for c in self.hpss_calls
652
if c.call.method == 'readv' and c.call.args[-1].endswith('.rix')]
653
self.assertLength(1, self.hpss_connections)
654
self.assertLength(0, readvs_of_rix_files)
655
self.expectFailure("branching to stacked requires VFS access",
656
self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
658
def test_branch_from_branch_with_ghosts(self):
659
self.setup_smart_server_with_call_log()
660
t = self.make_branch_and_tree('from')
661
for count in range(9):
662
t.commit(message='commit %d' % count)
663
t.set_parent_ids([t.last_revision(), b'ghost'])
664
t.commit(message='add commit with parent')
665
self.reset_smart_call_log()
666
out, err = self.run_bzr(['branch', self.get_url('from'),
668
# This figure represent the amount of work to perform this use case. It
669
# is entirely ok to reduce this number if a test fails due to rpc_count
670
# being too low. If rpc_count increases, more network roundtrips have
671
# become necessary for this use case. Please do not adjust this number
672
# upwards without agreement from bzr's network support maintainers.
673
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
674
self.assertLength(12, self.hpss_calls)
675
self.assertLength(1, self.hpss_connections)
678
554
class TestRemoteBranch(TestCaseWithSFTPServer):