~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_controldir/test_controldir.py

(jelmer) Add RepositoryFormat.supports_nesting_repositories. (Jelmer
 Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
        tree.commit('revision 1', rev_id='1')
173
173
        dir = self.make_bzrdir('source')
174
174
        repo = dir.create_repository()
 
175
        if not repo._format.supports_nesting_repositories:
 
176
            raise TestNotApplicable("repository format does not support "
 
177
                "nesting")
175
178
        repo.fetch(tree.branch.repository)
176
179
        self.assertTrue(repo.has_revision('1'))
177
180
        try:
188
191
            shared_repo = self.make_repository('shared', shared=True)
189
192
        except errors.IncompatibleFormat:
190
193
            return
 
194
        if not shared_repo._format.supports_nesting_repositories:
 
195
            raise TestNotApplicable("format does not support nesting "
 
196
                "repositories")
191
197
        # Make a branch, 'commit_tree', and working tree outside of the shared
192
198
        # repository, and commit some revisions to it.
193
199
        tree = self.make_branch_and_tree('commit_tree')
219
225
            shared_repo = self.make_repository('shared', shared=True)
220
226
        except errors.IncompatibleFormat:
221
227
            return
 
228
        if not shared_repo._format.supports_nesting_repositories:
 
229
            raise TestNotApplicable("format does not support nesting "
 
230
                "repositories")
222
231
        tree = self.make_branch_and_tree('commit_tree')
223
232
        self.build_tree(['commit_tree/foo'])
224
233
        tree.add('foo')
292
301
        tree.branch.repository.copy_content_into(source.repository)
293
302
        tree.branch.copy_content_into(source)
294
303
        try:
295
 
            self.make_repository('target', shared=True)
 
304
            shared_repo = self.make_repository('target', shared=True)
296
305
        except errors.IncompatibleFormat:
297
306
            return
 
307
        if not shared_repo._format.supports_nesting_repositories:
 
308
            raise TestNotApplicable("format does not support nesting "
 
309
                "repositories")
298
310
        dir = source.bzrdir
299
311
        target = dir.clone(self.get_url('target/child'))
300
312
        self.assertNotEqual(dir.transport.base, target.transport.base)
470
482
            shared_repo = self.make_repository('shared', shared=True)
471
483
        except errors.IncompatibleFormat:
472
484
            return
 
485
        if not shared_repo._format.supports_nesting_repositories:
 
486
            raise TestNotApplicable("format does not support nesting "
 
487
                "repositories")
473
488
        tree = self.make_branch_and_tree('commit_tree')
474
489
        self.build_tree(['commit_tree/foo'])
475
490
        tree.add('foo')
491
506
            shared_repo = self.make_repository('shared', shared=True)
492
507
        except errors.IncompatibleFormat:
493
508
            return
 
509
        if not shared_repo._format.supports_nesting_repositories:
 
510
            raise TestNotApplicable("format does not support nesting "
 
511
                "repositories")
494
512
        tree = self.make_branch_and_tree('commit_tree')
495
513
        self.build_tree(['commit_tree/foo'])
496
514
        tree.add('foo')
1367
1385
        except errors.IncompatibleFormat:
1368
1386
            # need a shared repository to test this.
1369
1387
            return
 
1388
        if not repo._format.supports_nesting_repositories:
 
1389
            raise TestNotApplicable("requires nesting repositories")
1370
1390
        url = self.get_url('intermediate')
1371
1391
        t = self.get_transport()
1372
1392
        t.mkdir('intermediate')
1393
1413
        except errors.IncompatibleFormat:
1394
1414
            # need a shared repository to test this.
1395
1415
            return
 
1416
        if not repo._format.supports_nesting_repositories:
 
1417
            return
1396
1418
        url = self.get_url('childbzrdir')
1397
1419
        self.get_transport().mkdir('childbzrdir')
1398
1420
        made_control = self.bzrdir_format.initialize(url)
1408
1430
                         found_repo.bzrdir.root_transport.base)
1409
1431
 
1410
1432
    def test_find_repository_standalone_with_containing_shared_repository(self):
1411
 
        # find repo inside a standalone repo inside a shared repo finds the standalone repo
 
1433
        # find repo inside a standalone repo inside a shared repo finds the
 
1434
        # standalone repo
1412
1435
        try:
1413
1436
            containing_repo = self.make_repository('.', shared=True)
1414
1437
        except errors.IncompatibleFormat:
1415
1438
            # need a shared repository to test this.
1416
1439
            return
 
1440
        if not containing_repo._format.supports_nesting_repositories:
 
1441
            raise TestNotApplicable("format does not support "
 
1442
                "nesting repositories")
1417
1443
        child_repo = self.make_repository('childrepo')
1418
1444
        opened_control = bzrdir.BzrDir.open(self.get_url('childrepo'))
1419
1445
        found_repo = opened_control.find_repository()
1427
1453
        except errors.IncompatibleFormat:
1428
1454
            # need a shared repository to test this.
1429
1455
            return
 
1456
        if not containing_repo._format.supports_nesting_repositories:
 
1457
            return
1430
1458
        url = self.get_url('childrepo')
1431
1459
        self.get_transport().mkdir('childrepo')
1432
1460
        child_control = self.bzrdir_format.initialize(url)
1446
1474
        except errors.IncompatibleFormat:
1447
1475
            # need a shared repository to test this.
1448
1476
            return
 
1477
        if not repo._format.supports_nesting_repositories:
 
1478
            return
1449
1479
        url = self.get_url('intermediate')
1450
1480
        t = self.get_transport()
1451
1481
        t.mkdir('intermediate')