~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-19 08:31:08 UTC
  • mfrom: (1666.1.5 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060419083108-fab2970f4575b010
Change the default branch format to be metadir. (Robert Collins, Aaron Bentley).

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
import bzrlib.gpg
34
34
from bzrlib.osutils import getcwd
35
35
from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
 
36
from bzrlib.tests.bzrdir_implementations.test_bzrdir import TestCaseWithBzrDir
36
37
from bzrlib.trace import mutter
37
38
import bzrlib.transactions as transactions
38
39
from bzrlib.transport import get_transport
47
48
# hooking into the Transport.
48
49
 
49
50
 
50
 
class TestCaseWithBranch(TestCaseWithTransport):
 
51
class TestCaseWithBranch(TestCaseWithBzrDir):
51
52
 
52
53
    def setUp(self):
53
54
        super(TestCaseWithBranch, self).setUp()
55
56
 
56
57
    def get_branch(self):
57
58
        if self.branch is None:
58
 
            self.branch = self.make_branch(None)
 
59
            self.branch = self.make_branch('')
59
60
        return self.branch
60
61
 
61
 
    def make_branch(self, relpath):
62
 
        repo = self.make_repository(relpath)
 
62
    def make_branch(self, relpath, format=None):
 
63
        repo = self.make_repository(relpath, format=format)
63
64
        # fixme RBC 20060210 this isnt necessarily a fixable thing,
64
65
        # Skipped is the wrong exception to raise.
65
66
        try:
67
68
        except errors.UninitializableFormat:
68
69
            raise TestSkipped('Uninitializable branch format')
69
70
 
70
 
    def make_repository(self, relpath, shared=False):
71
 
        try:
72
 
            url = self.get_url(relpath)
73
 
            segments = url.split('/')
74
 
            if segments and segments[-1] not in ('', '.'):
75
 
                parent = '/'.join(segments[:-1])
76
 
                t = get_transport(parent)
77
 
                try:
78
 
                    t.mkdir(segments[-1])
79
 
                except FileExists:
80
 
                    pass
81
 
            made_control = self.bzrdir_format.initialize(url)
82
 
            return made_control.create_repository(shared=shared)
83
 
        except UninitializableFormat:
84
 
            raise TestSkipped("Format %s is not initializable.")
 
71
    def make_repository(self, relpath, shared=False, format=None):
 
72
        made_control = self.make_bzrdir(relpath, format=format)
 
73
        return made_control.create_repository(shared=shared)
85
74
 
86
75
 
87
76
class TestBranch(TestCaseWithBranch):