/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/test_bzrdir.py

  • Committer: Benoît Pierre
  • Date: 2009-02-24 00:25:32 UTC
  • mfrom: (4035 +trunk)
  • mto: (4056.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 4058.
  • Revision ID: benoit.pierre@gmail.com-20090224002532-i2f64ou15pa7if2y
Merge with upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    repository,
33
33
    osutils,
34
34
    symbol_versioning,
 
35
    remote,
35
36
    urlutils,
36
37
    win32utils,
37
38
    workingtree,
48
49
    TestSkipped,
49
50
    test_sftp_transport
50
51
    )
51
 
from bzrlib.tests.http_server import HttpServer
52
 
from bzrlib.tests.http_utils import (
53
 
    TestCaseWithTwoWebservers,
54
 
    HTTPServerRedirecting,
 
52
from bzrlib.tests import(
 
53
    http_server,
 
54
    http_utils,
55
55
    )
56
56
from bzrlib.tests.test_http import TestWithTransport_pycurl
57
57
from bzrlib.transport import get_transport
58
58
from bzrlib.transport.http._urllib import HttpTransport_urllib
59
59
from bzrlib.transport.memory import MemoryServer
 
60
from bzrlib.transport.nosmart import NoSmartTransportDecorator
 
61
from bzrlib.transport.readonly import ReadonlyTransportDecorator
60
62
from bzrlib.repofmt import knitrepo, weaverepo
61
63
 
62
64
 
83
85
        my_format_registry.register('weave', bzrdir.BzrDirFormat6,
84
86
            'Pre-0.8 format.  Slower and does not support checkouts or shared'
85
87
            ' repositories', deprecated=True)
86
 
        my_format_registry.register_lazy('lazy', 'bzrlib.bzrdir', 
 
88
        my_format_registry.register_lazy('lazy', 'bzrlib.bzrdir',
87
89
            'BzrDirFormat6', 'Format registered lazily', deprecated=True)
88
90
        my_format_registry.register_metadir('knit',
89
91
            'bzrlib.repofmt.knitrepo.RepositoryFormatKnit1',
116
118
        my_bzrdir = my_format_registry.make_bzrdir('weave')
117
119
        self.assertIsInstance(my_bzrdir, bzrdir.BzrDirFormat6)
118
120
        my_bzrdir = my_format_registry.make_bzrdir('default')
119
 
        self.assertIsInstance(my_bzrdir.repository_format, 
 
121
        self.assertIsInstance(my_bzrdir.repository_format,
120
122
            knitrepo.RepositoryFormatKnit1)
121
123
        my_bzrdir = my_format_registry.make_bzrdir('knit')
122
 
        self.assertIsInstance(my_bzrdir.repository_format, 
 
124
        self.assertIsInstance(my_bzrdir.repository_format,
123
125
            knitrepo.RepositoryFormatKnit1)
124
126
        my_bzrdir = my_format_registry.make_bzrdir('branch6')
125
127
        self.assertIsInstance(my_bzrdir.get_branch_format(),
129
131
        my_format_registry = self.make_format_registry()
130
132
        self.assertEqual('Format registered lazily',
131
133
                         my_format_registry.get_help('lazy'))
132
 
        self.assertEqual('Format using knits', 
 
134
        self.assertEqual('Format using knits',
133
135
                         my_format_registry.get_help('knit'))
134
 
        self.assertEqual('Format using knits', 
 
136
        self.assertEqual('Format using knits',
135
137
                         my_format_registry.get_help('default'))
136
138
        self.assertEqual('Pre-0.8 format.  Slower and does not support'
137
 
                         ' checkouts or shared repositories', 
 
139
                         ' checkouts or shared repositories',
138
140
                         my_format_registry.get_help('weave'))
139
 
        
 
141
 
140
142
    def test_help_topic(self):
141
143
        topics = help_topics.HelpTopicRegistry()
142
 
        topics.register('formats', self.make_format_registry().help_topic, 
143
 
                        'Directory formats')
144
 
        topic = topics.get_detail('formats')
145
 
        new, rest = topic.split('Experimental formats')
 
144
        registry = self.make_format_registry()
 
145
        topics.register('current-formats', registry.help_topic,
 
146
                        'Current formats')
 
147
        topics.register('other-formats', registry.help_topic,
 
148
                        'Other formats')
 
149
        new = topics.get_detail('current-formats')
 
150
        rest = topics.get_detail('other-formats')
146
151
        experimental, deprecated = rest.split('Deprecated formats')
147
 
        self.assertContainsRe(new, 'These formats can be used')
148
 
        self.assertContainsRe(new, 
 
152
        self.assertContainsRe(new, 'bzr help formats')
 
153
        self.assertContainsRe(new,
149
154
                ':knit:\n    \(native\) \(default\) Format using knits\n')
150
 
        self.assertContainsRe(experimental, 
 
155
        self.assertContainsRe(experimental,
151
156
                ':branch6:\n    \(native\) Experimental successor to knit')
152
 
        self.assertContainsRe(deprecated, 
 
157
        self.assertContainsRe(deprecated,
153
158
                ':lazy:\n    \(native\) Format registered lazily\n')
154
159
        self.assertNotContainsRe(new, 'hidden')
155
160
 
176
181
            'Pre-0.8 format.  Slower and does not support checkouts or shared'
177
182
            ' repositories', deprecated=True, alias=True)
178
183
        self.assertEqual(frozenset(['weavealias']), a_registry.aliases())
179
 
    
 
184
 
180
185
 
181
186
class SampleBranch(bzrlib.branch.Branch):
182
187
    """A dummy branch for guess what, dummy use."""
185
190
        self.bzrdir = dir
186
191
 
187
192
 
 
193
class SampleRepository(bzrlib.repository.Repository):
 
194
    """A dummy repo."""
 
195
 
 
196
    def __init__(self, dir):
 
197
        self.bzrdir = dir
 
198
 
 
199
 
188
200
class SampleBzrDir(bzrdir.BzrDir):
189
201
    """A sample BzrDir implementation to allow testing static methods."""
190
202
 
194
206
 
195
207
    def open_repository(self):
196
208
        """See BzrDir.open_repository."""
197
 
        return "A repository"
 
209
        return SampleRepository(self)
198
210
 
199
211
    def create_branch(self):
200
212
        """See BzrDir.create_branch."""
208
220
class SampleBzrDirFormat(bzrdir.BzrDirFormat):
209
221
    """A sample format
210
222
 
211
 
    this format is initializable, unsupported to aid in testing the 
 
223
    this format is initializable, unsupported to aid in testing the
212
224
    open and open_downlevel routines.
213
225
    """
214
226
 
235
247
    def test_find_format(self):
236
248
        # is the right format object found for a branch?
237
249
        # create a branch with a few known format objects.
238
 
        # this is not quite the same as 
 
250
        # this is not quite the same as
239
251
        t = get_transport(self.get_url())
240
252
        self.build_tree(["foo/", "bar/"], transport=t)
241
253
        def check_format(format, url):
245
257
            self.failUnless(isinstance(found_format, format.__class__))
246
258
        check_format(bzrdir.BzrDirFormat5(), "foo")
247
259
        check_format(bzrdir.BzrDirFormat6(), "bar")
248
 
        
 
260
 
249
261
    def test_find_format_nothing_there(self):
250
262
        self.assertRaises(NotBranchError,
251
263
                          bzrdir.BzrDirFormat.find_format,
295
307
                          branch.bzrdir.open_repository)
296
308
 
297
309
    def test_create_branch_and_repo_under_shared_force_new(self):
298
 
        # creating a branch and repo in a shared repo can be forced to 
 
310
        # creating a branch and repo in a shared repo can be forced to
299
311
        # make a new repo
300
312
        format = bzrdir.format_registry.make_bzrdir('knit')
301
313
        self.make_repository('.', shared=True, format=format)
306
318
 
307
319
    def test_create_standalone_working_tree(self):
308
320
        format = SampleBzrDirFormat()
309
 
        # note this is deliberately readonly, as this failure should 
 
321
        # note this is deliberately readonly, as this failure should
310
322
        # occur before any writes.
311
323
        self.assertRaises(errors.NotLocalUrl,
312
324
                          bzrdir.BzrDir.create_standalone_workingtree,
313
325
                          self.get_readonly_url(), format=format)
314
 
        tree = bzrdir.BzrDir.create_standalone_workingtree('.', 
 
326
        tree = bzrdir.BzrDir.create_standalone_workingtree('.',
315
327
                                                           format=format)
316
328
        self.assertEqual('A tree', tree)
317
329
 
319
331
        # create standalone working tree always makes a repo.
320
332
        format = bzrdir.format_registry.make_bzrdir('knit')
321
333
        self.make_repository('.', shared=True, format=format)
322
 
        # note this is deliberately readonly, as this failure should 
 
334
        # note this is deliberately readonly, as this failure should
323
335
        # occur before any writes.
324
336
        self.assertRaises(errors.NotLocalUrl,
325
337
                          bzrdir.BzrDir.create_standalone_workingtree,
326
338
                          self.get_readonly_url('child'), format=format)
327
 
        tree = bzrdir.BzrDir.create_standalone_workingtree('child', 
 
339
        tree = bzrdir.BzrDir.create_standalone_workingtree('child',
328
340
            format=format)
329
341
        tree.bzrdir.open_repository()
330
342
 
349
361
        self.vfs_transport_factory = MemoryServer
350
362
        # outside a repo the default convenience output is a repo+branch_tree
351
363
        format = bzrdir.format_registry.make_bzrdir('knit')
352
 
        branch = bzrdir.BzrDir.create_branch_convenience(self.get_url(), 
 
364
        branch = bzrdir.BzrDir.create_branch_convenience(self.get_url(),
353
365
                                                         format=format)
354
366
        self.assertRaises(errors.NoWorkingTree,
355
367
                          branch.bzrdir.open_workingtree)
365
377
        branch.bzrdir.open_workingtree()
366
378
        self.assertRaises(errors.NoRepositoryPresent,
367
379
                          branch.bzrdir.open_repository)
368
 
            
 
380
 
369
381
    def test_create_branch_convenience_under_shared_repo_force_no_tree(self):
370
382
        # inside a repo the default convenience output is a branch+ follow the
371
383
        # repo tree policy but we can override that
377
389
                          branch.bzrdir.open_workingtree)
378
390
        self.assertRaises(errors.NoRepositoryPresent,
379
391
                          branch.bzrdir.open_repository)
380
 
            
 
392
 
381
393
    def test_create_branch_convenience_under_shared_repo_no_tree_policy(self):
382
394
        # inside a repo the default convenience output is a branch+ follow the
383
395
        # repo tree policy
384
396
        format = bzrdir.format_registry.make_bzrdir('knit')
385
397
        repo = self.make_repository('.', shared=True, format=format)
386
398
        repo.set_make_working_trees(False)
387
 
        branch = bzrdir.BzrDir.create_branch_convenience('child', 
 
399
        branch = bzrdir.BzrDir.create_branch_convenience('child',
388
400
                                                         format=format)
389
401
        self.assertRaises(errors.NoWorkingTree,
390
402
                          branch.bzrdir.open_workingtree)
547
559
    def setUp(self):
548
560
        super(ChrootedTests, self).setUp()
549
561
        if not self.vfs_transport_factory == MemoryServer:
550
 
            self.transport_readonly_server = HttpServer
 
562
            self.transport_readonly_server = http_server.HttpServer
551
563
 
552
564
    def local_branch_path(self, branch):
553
565
         return os.path.realpath(urlutils.local_path_from_url(branch.base))
714
726
        opened_bzrdir = bzrdir.BzrDir.open_from_transport(transport)
715
727
        self.assertEqual(transport.base, opened_bzrdir.root_transport.base)
716
728
        self.assertIsInstance(opened_bzrdir, bzrdir.BzrDir)
717
 
        
 
729
 
718
730
    def test_open_from_transport_no_bzrdir(self):
719
731
        transport = get_transport(self.get_url())
720
732
        self.assertRaises(NotBranchError, bzrdir.BzrDir.open_from_transport,
869
881
 
870
882
    def test_needs_conversion_different_working_tree(self):
871
883
        # meta1dirs need an conversion if any element is not the default.
872
 
        old_format = bzrdir.BzrDirFormat.get_default_format()
873
 
        # test with 
874
 
        new_default = bzrdir.format_registry.make_bzrdir('dirstate')
875
 
        bzrdir.BzrDirFormat._set_default_format(new_default)
876
 
        try:
877
 
            tree = self.make_branch_and_tree('tree', format='knit')
878
 
            self.assertTrue(tree.bzrdir.needs_format_conversion())
879
 
        finally:
880
 
            bzrdir.BzrDirFormat._set_default_format(old_format)
 
884
        new_format = bzrdir.format_registry.make_bzrdir('dirstate')
 
885
        tree = self.make_branch_and_tree('tree', format='knit')
 
886
        self.assertTrue(tree.bzrdir.needs_format_conversion(
 
887
            new_format))
 
888
 
 
889
    def test_initialize_on_format_uses_smart_transport(self):
 
890
        self.setup_smart_server_with_call_log()
 
891
        new_format = bzrdir.format_registry.make_bzrdir('dirstate')
 
892
        transport = self.get_transport('target')
 
893
        transport.ensure_base()
 
894
        self.reset_smart_call_log()
 
895
        instance = new_format.initialize_on_transport(transport)
 
896
        self.assertIsInstance(instance, remote.RemoteBzrDir)
 
897
        rpc_count = len(self.hpss_calls)
 
898
        # This figure represent the amount of work to perform this use case. It
 
899
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
900
        # being too low. If rpc_count increases, more network roundtrips have
 
901
        # become necessary for this use case. Please do not adjust this number
 
902
        # upwards without agreement from bzr's network support maintainers.
 
903
        self.assertEqual(2, rpc_count)
881
904
 
882
905
 
883
906
class TestFormat5(TestCaseWithTransport):
884
907
    """Tests specific to the version 5 bzrdir format."""
885
908
 
886
909
    def test_same_lockfiles_between_tree_repo_branch(self):
887
 
        # this checks that only a single lockfiles instance is created 
 
910
        # this checks that only a single lockfiles instance is created
888
911
        # for format 5 objects
889
912
        dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
890
913
        def check_dir_components_use_same_lock(dir):
897
920
        # and if we open it normally.
898
921
        dir = bzrdir.BzrDir.open(self.get_url())
899
922
        check_dir_components_use_same_lock(dir)
900
 
    
 
923
 
901
924
    def test_can_convert(self):
902
925
        # format 5 dirs are convertable
903
926
        dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
904
927
        self.assertTrue(dir.can_convert_format())
905
 
    
 
928
 
906
929
    def test_needs_conversion(self):
907
 
        # format 5 dirs need a conversion if they are not the default.
908
 
        # and they start of not the default.
909
 
        old_format = bzrdir.BzrDirFormat.get_default_format()
910
 
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirFormat5())
911
 
        try:
912
 
            dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
913
 
            self.assertFalse(dir.needs_format_conversion())
914
 
        finally:
915
 
            bzrdir.BzrDirFormat._set_default_format(old_format)
916
 
        self.assertTrue(dir.needs_format_conversion())
 
930
        # format 5 dirs need a conversion if they are not the default,
 
931
        # and they aren't
 
932
        dir = bzrdir.BzrDirFormat5().initialize(self.get_url())
 
933
        # don't need to convert it to itself
 
934
        self.assertFalse(dir.needs_format_conversion(bzrdir.BzrDirFormat5()))
 
935
        # do need to convert it to the current default
 
936
        self.assertTrue(dir.needs_format_conversion(
 
937
            bzrdir.BzrDirFormat.get_default_format()))
917
938
 
918
939
 
919
940
class TestFormat6(TestCaseWithTransport):
920
941
    """Tests specific to the version 6 bzrdir format."""
921
942
 
922
943
    def test_same_lockfiles_between_tree_repo_branch(self):
923
 
        # this checks that only a single lockfiles instance is created 
 
944
        # this checks that only a single lockfiles instance is created
924
945
        # for format 6 objects
925
946
        dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
926
947
        def check_dir_components_use_same_lock(dir):
933
954
        # and if we open it normally.
934
955
        dir = bzrdir.BzrDir.open(self.get_url())
935
956
        check_dir_components_use_same_lock(dir)
936
 
    
 
957
 
937
958
    def test_can_convert(self):
938
959
        # format 6 dirs are convertable
939
960
        dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
940
961
        self.assertTrue(dir.can_convert_format())
941
 
    
 
962
 
942
963
    def test_needs_conversion(self):
943
964
        # format 6 dirs need an conversion if they are not the default.
944
 
        old_format = bzrdir.BzrDirFormat.get_default_format()
945
 
        bzrdir.BzrDirFormat._set_default_format(bzrdir.BzrDirMetaFormat1())
946
 
        try:
947
 
            dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
948
 
            self.assertTrue(dir.needs_format_conversion())
949
 
        finally:
950
 
            bzrdir.BzrDirFormat._set_default_format(old_format)
 
965
        dir = bzrdir.BzrDirFormat6().initialize(self.get_url())
 
966
        self.assertTrue(dir.needs_format_conversion(
 
967
            bzrdir.BzrDirFormat.get_default_format()))
951
968
 
952
969
 
953
970
class NotBzrDir(bzrlib.bzrdir.BzrDir):
984
1001
 
985
1002
class TestNotBzrDir(TestCaseWithTransport):
986
1003
    """Tests for using the bzrdir api with a non .bzr based disk format.
987
 
    
 
1004
 
988
1005
    If/when one of these is in the core, we can let the implementation tests
989
1006
    verify this works.
990
1007
    """
991
1008
 
992
1009
    def test_create_and_find_format(self):
993
 
        # create a .notbzr dir 
 
1010
        # create a .notbzr dir
994
1011
        format = NotBzrDirFormat()
995
1012
        dir = format.initialize(self.get_url())
996
1013
        self.assertIsInstance(dir, NotBzrDir)
1021
1038
    def setUp(self):
1022
1039
        super(NonLocalTests, self).setUp()
1023
1040
        self.vfs_transport_factory = MemoryServer
1024
 
    
 
1041
 
1025
1042
    def test_create_branch_convenience(self):
1026
1043
        # outside a repo the default convenience output is a repo+branch_tree
1027
1044
        format = bzrdir.format_registry.make_bzrdir('knit')
1064
1081
                              workingtree.WorkingTreeFormat3)
1065
1082
 
1066
1083
 
1067
 
class TestHTTPRedirectionLoop(object):
1068
 
    """Test redirection loop between two http servers.
 
1084
class TestHTTPRedirections(object):
 
1085
    """Test redirection between two http servers.
1069
1086
 
1070
1087
    This MUST be used by daughter classes that also inherit from
1071
1088
    TestCaseWithTwoWebservers.
1072
1089
 
1073
1090
    We can't inherit directly from TestCaseWithTwoWebservers or the
1074
1091
    test framework will try to create an instance which cannot
1075
 
    run, its implementation being incomplete. 
 
1092
    run, its implementation being incomplete.
1076
1093
    """
1077
1094
 
1078
 
    # Should be defined by daughter classes to ensure redirection
1079
 
    # still use the same transport implementation (not currently
1080
 
    # enforced as it's a bit tricky to get right (see the FIXME
1081
 
    # in BzrDir.open_from_transport for the unique use case so
1082
 
    # far)
1083
 
    _qualifier = None
1084
 
 
1085
1095
    def create_transport_readonly_server(self):
1086
 
        return HTTPServerRedirecting()
 
1096
        return http_utils.HTTPServerRedirecting()
1087
1097
 
1088
1098
    def create_transport_secondary_server(self):
1089
 
        return HTTPServerRedirecting()
 
1099
        return http_utils.HTTPServerRedirecting()
1090
1100
 
1091
1101
    def setUp(self):
1092
 
        # Both servers redirect to each server creating a loop
1093
 
        super(TestHTTPRedirectionLoop, self).setUp()
 
1102
        super(TestHTTPRedirections, self).setUp()
1094
1103
        # The redirections will point to the new server
1095
1104
        self.new_server = self.get_readonly_server()
1096
1105
        # The requests to the old server will be redirected
1097
1106
        self.old_server = self.get_secondary_server()
1098
1107
        # Configure the redirections
1099
1108
        self.old_server.redirect_to(self.new_server.host, self.new_server.port)
 
1109
 
 
1110
    def test_loop(self):
 
1111
        # Both servers redirect to each other creating a loop
1100
1112
        self.new_server.redirect_to(self.old_server.host, self.old_server.port)
1101
 
 
1102
 
    def _qualified_url(self, host, port):
1103
 
        return 'http+%s://%s:%s' % (self._qualifier, host, port)
1104
 
 
1105
 
    def test_loop(self):
1106
1113
        # Starting from either server should loop
1107
 
        old_url = self._qualified_url(self.old_server.host, 
 
1114
        old_url = self._qualified_url(self.old_server.host,
1108
1115
                                      self.old_server.port)
1109
1116
        oldt = self._transport(old_url)
1110
1117
        self.assertRaises(errors.NotBranchError,
1111
1118
                          bzrdir.BzrDir.open_from_transport, oldt)
1112
 
        new_url = self._qualified_url(self.new_server.host, 
 
1119
        new_url = self._qualified_url(self.new_server.host,
1113
1120
                                      self.new_server.port)
1114
1121
        newt = self._transport(new_url)
1115
1122
        self.assertRaises(errors.NotBranchError,
1116
1123
                          bzrdir.BzrDir.open_from_transport, newt)
1117
1124
 
1118
 
 
1119
 
class TestHTTPRedirections_urllib(TestHTTPRedirectionLoop,
1120
 
                                  TestCaseWithTwoWebservers):
 
1125
    def test_qualifier_preserved(self):
 
1126
        wt = self.make_branch_and_tree('branch')
 
1127
        old_url = self._qualified_url(self.old_server.host,
 
1128
                                      self.old_server.port)
 
1129
        start = self._transport(old_url).clone('branch')
 
1130
        bdir = bzrdir.BzrDir.open_from_transport(start)
 
1131
        # Redirection should preserve the qualifier, hence the transport class
 
1132
        # itself.
 
1133
        self.assertIsInstance(bdir.root_transport, type(start))
 
1134
 
 
1135
 
 
1136
class TestHTTPRedirections_urllib(TestHTTPRedirections,
 
1137
                                  http_utils.TestCaseWithTwoWebservers):
1121
1138
    """Tests redirections for urllib implementation"""
1122
1139
 
1123
 
    _qualifier = 'urllib'
1124
1140
    _transport = HttpTransport_urllib
1125
1141
 
 
1142
    def _qualified_url(self, host, port):
 
1143
        return 'http+urllib://%s:%s' % (host, port)
 
1144
 
1126
1145
 
1127
1146
 
1128
1147
class TestHTTPRedirections_pycurl(TestWithTransport_pycurl,
1129
 
                                  TestHTTPRedirectionLoop,
1130
 
                                  TestCaseWithTwoWebservers):
 
1148
                                  TestHTTPRedirections,
 
1149
                                  http_utils.TestCaseWithTwoWebservers):
1131
1150
    """Tests redirections for pycurl implementation"""
1132
1151
 
1133
 
    _qualifier = 'pycurl'
 
1152
    def _qualified_url(self, host, port):
 
1153
        return 'http+pycurl://%s:%s' % (host, port)
 
1154
 
 
1155
 
 
1156
class TestHTTPRedirections_nosmart(TestHTTPRedirections,
 
1157
                                  http_utils.TestCaseWithTwoWebservers):
 
1158
    """Tests redirections for the nosmart decorator"""
 
1159
 
 
1160
    _transport = NoSmartTransportDecorator
 
1161
 
 
1162
    def _qualified_url(self, host, port):
 
1163
        return 'nosmart+http://%s:%s' % (host, port)
 
1164
 
 
1165
 
 
1166
class TestHTTPRedirections_readonly(TestHTTPRedirections,
 
1167
                                    http_utils.TestCaseWithTwoWebservers):
 
1168
    """Tests redirections for readonly decoratror"""
 
1169
 
 
1170
    _transport = ReadonlyTransportDecorator
 
1171
 
 
1172
    def _qualified_url(self, host, port):
 
1173
        return 'readonly+http://%s:%s' % (host, port)
1134
1174
 
1135
1175
 
1136
1176
class TestDotBzrHidden(TestCaseWithTransport):
1171
1211
 
1172
1212
class _TestBzrDir(bzrdir.BzrDirMeta1):
1173
1213
    """Test BzrDir implementation for TestBzrDirSprout.
1174
 
    
 
1214
 
1175
1215
    When created a _TestBzrDir already has repository and a branch.  The branch
1176
1216
    is a test double as well.
1177
1217
    """
1218
1258
        Usually, BzrDir.sprout should delegate to the branch's sprout method
1219
1259
        for part of the work.  This allows the source branch to control the
1220
1260
        choice of format for the new branch.
1221
 
        
 
1261
 
1222
1262
        There are exceptions, but this tests avoids them:
1223
1263
          - if there's no branch in the source bzrdir,
1224
1264
          - or if the stacking has been requested and the format needs to be