/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/per_branch/test_branch.py

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    revision,
35
35
    shelf,
36
36
    tests,
 
37
    tree as _mod_tree,
37
38
    )
38
39
from breezy.bzr import (
39
40
    branch as _mod_bzrbranch,
162
163
        rev1 = wt_a.commit('commit one')
163
164
 
164
165
        branch_b = wt_a.branch.controldir.sprout('b', revision_id=rev1).open_branch()
165
 
        self.assertEqual(wt_a.branch.base, branch_b.get_parent())
 
166
        self.assertEqual(wt_a.branch.user_url, branch_b.get_parent())
166
167
        return branch_b
167
168
 
168
169
    def test_clone_branch_nickname(self):
424
425
        branch_a = tree_a.branch
425
426
        checkout_b = branch_a.create_checkout('b')
426
427
        self.assertEqual('null:', checkout_b.last_revision())
427
 
        rev1 = checkout_b.commit('rev1')
 
428
        try:
 
429
            rev1 = checkout_b.commit('rev1')
 
430
        except errors.NoRoundtrippingSupport:
 
431
            raise tests.TestNotApplicable(
 
432
                    'roundtripping between %r and %r not supported' %
 
433
                    (checkout_b.branch, checkout_b.branch.get_master_branch()))
428
434
        self.assertEqual(rev1, branch_a.last_revision())
429
435
        self.assertNotEqual(checkout_b.branch.base, branch_a.base)
430
436
 
492
498
        self.assertFalse(revision.NULL_REVISION in must_fetch)
493
499
        self.assertFalse(revision.NULL_REVISION in should_fetch)
494
500
 
 
501
    def test_create_memorytree(self):
 
502
        tree = self.make_branch_and_tree('a')
 
503
        self.assertIsInstance(tree.branch.create_memorytree(), _mod_tree.Tree)
 
504
 
495
505
 
496
506
class TestBranchFormat(per_branch.TestCaseWithBranch):
497
507
 
628
638
            # because the default open will not open them and
629
639
            # they may not be initializable.
630
640
            return
631
 
        made_branch = self.make_branch('.')
 
641
        made_controldir = self.make_controldir('.')
 
642
        made_controldir.create_repository()
 
643
        if made_controldir._format.colocated_branches:
 
644
            # Formats that support colocated branches sometimes have a default
 
645
            # branch that is a reference branch (such as Git). Cope with
 
646
            # those by creating a different colocated branch.
 
647
            name = 'foo'
 
648
        else:
 
649
            name = None
 
650
        try:
 
651
            made_branch = made_controldir.create_branch(name)
 
652
        except errors.UninitializableFormat:
 
653
            raise tests.TestNotApplicable('Uninitializable branch format')
 
654
 
632
655
        self.assertEqual(None,
633
 
            made_branch._format.get_reference(made_branch.controldir))
 
656
            made_branch._format.get_reference(made_branch.controldir, name))
634
657
 
635
658
    def test_set_reference(self):
636
659
        """set_reference on all regular branches should be callable."""
649
672
            pass
650
673
        else:
651
674
            ref = this_branch._format.get_reference(this_branch.controldir)
652
 
            self.assertEqual(ref, other_branch.base)
 
675
            self.assertEqual(ref, other_branch.user_url)
653
676
 
654
677
    def test_format_initialize_find_open(self):
655
678
        # loopback test to check the current format initializes to itself.
1022
1045
        br = self.make_branch('branch')
1023
1046
        self.assertIsInstance(br.user_url, str)
1024
1047
        self.assertEqual(br.user_url, br.user_transport.base)
1025
 
        # for all current bzrdir implementations the user dir must be 
1026
 
        # above the control dir but we might need to relax that?
1027
 
        self.assertEqual(br.control_url.find(br.user_url), 0)
1028
1048
        self.assertEqual(br.control_url, br.control_transport.base)
1029
1049
 
1030
1050