/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/blackbox/test_branch.py

  • Committer: Breezy landing bot
  • Author(s): Gustav Hartvigsson
  • Date: 2021-01-10 18:46:30 UTC
  • mfrom: (7526.1.1 brz-removed-api-doc)
  • mto: This revision was merged to the branch mainline in revision 7532.
  • Revision ID: breezy.the.bot@gmail.com-20210110184630-dxu0g9dqq020uiw6
Drop documentation for removed API API.

Merged from https://code.launchpad.net/~gustav-hartvigsson/brz/removed-api-doc/+merge/396033

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    HardlinkFeature,
39
39
    )
40
40
from breezy.tests.blackbox import test_switch
41
 
from breezy.tests.matchers import ContainsNoVfsCalls
42
41
from breezy.tests.test_sftp_transport import TestCaseWithSFTPServer
43
42
from breezy.tests.script import run_script
44
43
from breezy.urlutils import local_path_to_url, strip_trailing_slash
107
106
        self.assertEqual('Branched 0 revisions.\n', err)
108
107
        self.assertPathExists('a')
109
108
 
 
109
    def test_from_name(self):
 
110
        """Branch from a colocated branch into a regular branch."""
 
111
        os.mkdir('b')
 
112
        tree = self.example_branch('b/a', format='development-colo')
 
113
        tree.controldir.create_branch(name='somecolo')
 
114
        out, err = self.run_bzr('branch -b somecolo %s' %
 
115
                                local_path_to_url('b/a'))
 
116
        self.assertEqual('', out)
 
117
        self.assertEqual('Branched 0 revisions.\n', err)
 
118
        self.assertPathExists('a')
 
119
 
110
120
    def test_branch_broken_pack(self):
111
121
        """branching with a corrupted pack file."""
112
122
        self.example_branch('a')
541
551
            err)
542
552
 
543
553
 
544
 
class TestSmartServerBranching(tests.TestCaseWithTransport):
545
 
 
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)
561
 
        self.expectFailure(
562
 
            "branching to the same branch requires VFS access",
563
 
            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)
564
 
 
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'),
572
 
                                 'local-target'])
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)
581
 
 
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
588
 
                                           ).open_workingtree()
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'),
595
 
                                 'local-target'])
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)
604
 
 
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(
609
 
            builder)
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)
624
 
 
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'),
632
 
                                 'local-target'])
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)
646
 
 
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'),
656
 
                                 'local-target'])
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)
665
 
 
666
 
 
667
554
class TestRemoteBranch(TestCaseWithSFTPServer):
668
555
 
669
556
    def setUp(self):