~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_branch.py

Merge smart server changes that are already with PQM, and fix conflict and formatting nit in NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
from bzrlib.osutils import getcwd
41
41
import bzrlib.revision
42
42
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
43
 
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
 
43
from bzrlib.tests.branch_implementations import TestCaseWithBranch
44
44
from bzrlib.tests.HttpServer import HttpServer
45
45
from bzrlib.trace import mutter
46
46
from bzrlib.transport import get_transport
49
49
from bzrlib.workingtree import WorkingTree
50
50
 
51
51
 
52
 
class TestCaseWithBranch(TestCaseWithBzrDir):
53
 
 
54
 
    def setUp(self):
55
 
        super(TestCaseWithBranch, self).setUp()
56
 
        self.branch = None
57
 
 
58
 
    def get_branch(self):
59
 
        if self.branch is None:
60
 
            self.branch = self.make_branch('')
61
 
        return self.branch
62
 
 
63
 
    def make_branch(self, relpath, format=None):
64
 
        repo = self.make_repository(relpath, format=format)
65
 
        # fixme RBC 20060210 this isnt necessarily a fixable thing,
66
 
        # Skipped is the wrong exception to raise.
67
 
        try:
68
 
            return self.branch_format.initialize(repo.bzrdir)
69
 
        except errors.UninitializableFormat:
70
 
            raise TestSkipped('Uninitializable branch format')
71
 
 
72
 
    def make_repository(self, relpath, shared=False, format=None):
73
 
        made_control = self.make_bzrdir(relpath, format=format)
74
 
        return made_control.create_repository(shared=shared)
75
 
 
76
 
 
77
52
class TestBranch(TestCaseWithBranch):
78
53
 
79
54
    def test_append_revisions(self):
91
66
        self.assertEquals(br.revision_history(), ["rev1", "rev2", "rev3"])
92
67
        self.assertRaises(errors.ReservedId, br.append_revision, 'current:')
93
68
 
 
69
    def test_create_tree_with_merge(self):
 
70
        tree = self.create_tree_with_merge()
 
71
        ancestry_graph = tree.branch.repository.get_revision_graph('rev-3')
 
72
        self.assertEqual({'rev-1':[],
 
73
                          'rev-2':['rev-1'],
 
74
                          'rev-1.1.1':['rev-1'],
 
75
                          'rev-3':['rev-2', 'rev-1.1.1'],
 
76
                         }, ancestry_graph)
 
77
 
94
78
    def test_revision_ids_are_utf8(self):
95
79
        wt = self.make_branch_and_tree('tree')
96
80
        wt.commit('f', rev_id='rev1')