108
108
self.assertRaises(errors.UninitializableFormat,
109
109
self.bzrdir_format.initialize, t.base)
111
def test_multiple_initialization(self):
112
# loopback test to check the current format initializes to itself.
113
if not self.bzrdir_format.is_initializable():
114
# unsupported formats are not loopback testable
115
# because the default open will not open them and
116
# they may not be initializable.
117
raise TestNotApplicable("format is not initializable")
118
self.bzrdir_format.initialize('.')
119
self.assertRaises(errors.AlreadyControlDirError,
120
self.bzrdir_format.initialize, '.')
122
111
def test_create_null_workingtree(self):
123
112
dir = self.make_bzrdir('dir1')
124
113
dir.create_repository()
159
148
bzrdir.create_branch()
160
149
bzrdir.open_branch()
162
def test_destroy_branch_no_branch(self):
163
branch = self.make_repository('branch')
164
bzrdir = branch.bzrdir
166
self.assertRaises(errors.NotBranchError, bzrdir.destroy_branch)
167
except (errors.UnsupportedOperation, errors.TransportNotPossible):
168
raise TestNotApplicable('Format does not support destroying branch')
170
151
def test_destroy_repository(self):
171
152
repo = self.make_repository('repository')
172
153
bzrdir = repo.bzrdir
434
415
"not support stacking")
435
416
self.assertEqual(child.open_branch().get_stacked_on_url(), branch.base)
437
def test_set_branch_reference(self):
438
"""set_branch_reference creates a branch reference"""
439
referenced_branch = self.make_branch('referenced')
440
dir = self.make_bzrdir('source')
442
reference = dir.set_branch_reference(referenced_branch)
443
except errors.IncompatibleFormat:
444
# this is ok too, not all formats have to support references.
445
raise TestNotApplicable("control directory does not "
446
"support branch references")
448
referenced_branch.bzrdir.root_transport.abspath('') + '/',
449
dir.get_branch_reference())
451
def test_set_branch_reference_on_existing_reference(self):
452
"""set_branch_reference creates a branch reference"""
453
referenced_branch1 = self.make_branch('old-referenced')
454
referenced_branch2 = self.make_branch('new-referenced')
455
dir = self.make_bzrdir('source')
457
reference = dir.set_branch_reference(referenced_branch1)
458
except errors.IncompatibleFormat:
459
# this is ok too, not all formats have to support references.
460
raise TestNotApplicable("control directory does not "
461
"support branch references")
462
reference = dir.set_branch_reference(referenced_branch2)
464
referenced_branch2.bzrdir.root_transport.abspath('') + '/',
465
dir.get_branch_reference())
467
def test_set_branch_reference_on_existing_branch(self):
468
"""set_branch_reference creates a branch reference"""
469
referenced_branch = self.make_branch('referenced')
470
dir = self.make_branch('source').bzrdir
472
reference = dir.set_branch_reference(referenced_branch)
473
except errors.IncompatibleFormat:
474
# this is ok too, not all formats have to support references.
475
raise TestNotApplicable("control directory does not "
476
"support branch references")
478
referenced_branch.bzrdir.root_transport.abspath('') + '/',
479
dir.get_branch_reference())
481
418
def test_get_branch_reference_on_reference(self):
482
419
"""get_branch_reference should return the right url."""
483
420
referenced_branch = self.make_branch('referenced')
484
421
dir = self.make_bzrdir('source')
486
dir.set_branch_reference(referenced_branch)
423
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
424
target_branch=referenced_branch)
487
425
except errors.IncompatibleFormat:
488
426
# this is ok too, not all formats have to support references.
489
427
raise TestNotApplicable("control directory does not "
714
652
referenced_branch = self.make_branch('referenced')
715
653
dir = self.make_bzrdir('source')
717
dir.set_branch_reference(referenced_branch)
655
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
656
target_branch=referenced_branch)
718
657
except errors.IncompatibleFormat:
719
658
raise TestNotApplicable("format does not support branch "
733
672
referenced_tree.commit('1', rev_id='1', allow_pointless=True)
734
673
dir = self.make_bzrdir('source')
736
dir.set_branch_reference(referenced_tree.branch)
675
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
676
target_branch=referenced_tree.branch)
737
677
except errors.IncompatibleFormat:
738
678
raise TestNotApplicable("format does not support branch "
759
699
referenced_tree.commit('1', rev_id='1', allow_pointless=True)
760
700
dir = self.make_bzrdir('source')
762
dir.set_branch_reference(referenced_tree.branch)
702
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
703
target_branch=referenced_tree.branch)
763
704
except errors.IncompatibleFormat:
764
705
# this is ok too, not all formats have to support references.
765
706
raise TestNotApplicable("format does not support "
910
851
referenced_branch = self.make_branch('referencced')
911
852
dir = self.make_bzrdir('source')
913
dir.set_branch_reference(referenced_branch)
854
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
855
target_branch=referenced_branch)
914
856
except errors.IncompatibleFormat:
915
857
# this is ok too, not all formats have to support references.
916
858
raise TestNotApplicable("format does not support "
936
878
referenced_branch = self.make_branch('referencced')
937
879
dir = self.make_bzrdir('source')
939
dir.set_branch_reference(referenced_branch)
881
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
882
target_branch=referenced_branch)
940
883
except errors.IncompatibleFormat:
941
884
# this is ok too, not all formats have to support references.
942
885
raise TestNotApplicable("format does not support "
1638
1581
master = self.make_branch('branch')
1639
1582
thisdir = self.make_bzrdir('this')
1641
thisdir.set_branch_reference(master)
1584
bzrlib.branch.BranchReferenceFormat().initialize(
1585
thisdir, target_branch=master)
1642
1586
except errors.IncompatibleFormat:
1643
1587
raise TestNotApplicable("format does not support "
1644
1588
"branch references")