/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 bzrlib/tests/branch_implementations/test_branch.py

  • Committer: Andrew Bennetts
  • Date: 2008-01-04 03:12:11 UTC
  • mfrom: (3164 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20080104031211-wy4uxo2j4elvip1j
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    transactions,
29
29
    remote,
30
30
    repository,
 
31
    tests,
31
32
    )
32
33
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
33
34
from bzrlib.delta import TreeDelta
41
42
import bzrlib.revision
42
43
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
43
44
from bzrlib.tests.branch_implementations import TestCaseWithBranch
44
 
from bzrlib.tests.HttpServer import HttpServer
 
45
from bzrlib.tests.http_server import HttpServer
45
46
from bzrlib.trace import mutter
46
47
from bzrlib.transport import get_transport
47
48
from bzrlib.transport.memory import MemoryServer
577
578
        self.assertEqual(None,
578
579
            made_branch._format.get_reference(made_branch.bzrdir))
579
580
 
 
581
    def test_set_reference(self):
 
582
        """set_reference on all regular branches should be callable."""
 
583
        if not self.branch_format.is_supported():
 
584
            # unsupported formats are not loopback testable
 
585
            # because the default open will not open them and
 
586
            # they may not be initializable.
 
587
            return
 
588
        this_branch = self.make_branch('this')
 
589
        other_branch = self.make_branch('other')
 
590
        try:
 
591
            this_branch._format.set_reference(this_branch.bzrdir, other_branch)
 
592
        except NotImplementedError:
 
593
            # that's ok
 
594
            pass
 
595
        else:
 
596
            ref = this_branch._format.get_reference(this_branch.bzrdir)
 
597
            self.assertEqual(ref, other_branch.base)
 
598
 
580
599
    def test_format_initialize_find_open(self):
581
600
        # loopback test to check the current format initializes to itself.
582
601
        if not self.branch_format.is_supported():
620
639
        try:
621
640
            branch.bind(branch2)
622
641
        except errors.UpgradeRequired:
623
 
            raise TestSkipped('Format does not support binding')
 
642
            raise tests.TestNotApplicable('Format does not support binding')
624
643
        self.assertTrue(branch.unbind())
625
644
        self.assertFalse(branch.unbind())
626
645
        self.assertIs(None, branch.get_bound_location())
630
649
        try:
631
650
            self.assertIs(None, branch.get_old_bound_location())
632
651
        except errors.UpgradeRequired:
633
 
            raise TestSkipped('Format does not store old bound locations')
 
652
            raise tests.TestNotApplicable(
 
653
                    'Format does not store old bound locations')
634
654
        branch2 = self.make_branch('branch2')
635
655
        branch.bind(branch2)
636
656
        self.assertIs(None, branch.get_old_bound_location())
637
657
        branch.unbind()
638
658
        self.assertContainsRe(branch.get_old_bound_location(), '\/branch2\/$')
639
659
 
 
660
    def test_bind_diverged(self):
 
661
        tree_a = self.make_branch_and_tree('tree_a')
 
662
        tree_a.commit('rev1a')
 
663
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
 
664
        tree_a.commit('rev2a')
 
665
        tree_b.commit('rev2b')
 
666
        try:
 
667
            tree_b.branch.bind(tree_a.branch)
 
668
        except errors.UpgradeRequired:
 
669
            raise tests.TestNotApplicable('Format does not support binding')
 
670
 
640
671
 
641
672
class TestStrict(TestCaseWithBranch):
642
673