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