~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from bzrlib import (
27
27
    branch,
28
28
    bzrdir,
 
29
    config,
29
30
    controldir,
30
31
    errors,
31
32
    help_topics,
1208
1209
 
1209
1210
    def __init__(self, *args, **kwargs):
1210
1211
        super(_TestBzrDir, self).__init__(*args, **kwargs)
1211
 
        self.test_branch = _TestBranch()
 
1212
        self.test_branch = _TestBranch(self.transport)
1212
1213
        self.test_branch.repository = self.create_repository()
1213
1214
 
1214
1215
    def open_branch(self, unsupported=False):
1225
1226
class _TestBranch(bzrlib.branch.Branch):
1226
1227
    """Test Branch implementation for TestBzrDirSprout."""
1227
1228
 
1228
 
    def __init__(self, *args, **kwargs):
 
1229
    def __init__(self, transport, *args, **kwargs):
1229
1230
        self._format = _TestBranchFormat()
 
1231
        self._transport = transport
 
1232
        self.base = transport.base
1230
1233
        super(_TestBranch, self).__init__(*args, **kwargs)
1231
1234
        self.calls = []
1232
1235
        self._parent = None
1233
1236
 
1234
1237
    def sprout(self, *args, **kwargs):
1235
1238
        self.calls.append('sprout')
1236
 
        return _TestBranch()
 
1239
        return _TestBranch(self._transport)
1237
1240
 
1238
1241
    def copy_content_into(self, destination, revision_id=None):
1239
1242
        self.calls.append('copy_content_into')
1244
1247
    def get_parent(self):
1245
1248
        return self._parent
1246
1249
 
 
1250
    def _get_config(self):
 
1251
        return config.TransportConfig(self._transport, 'branch.conf')
 
1252
 
1247
1253
    def set_parent(self, parent):
1248
1254
        self._parent = parent
1249
1255