415
415
"not support stacking")
416
416
self.assertEqual(child.open_branch().get_stacked_on_url(), branch.base)
418
def test_set_branch_reference(self):
419
"""set_branch_reference creates a branch reference"""
420
referenced_branch = self.make_branch('referenced')
421
dir = self.make_bzrdir('source')
423
reference = dir.set_branch_reference(referenced_branch)
424
except errors.IncompatibleFormat:
425
# this is ok too, not all formats have to support references.
426
raise TestNotApplicable("control directory does not "
427
"support branch references")
429
referenced_branch.bzrdir.root_transport.abspath('') + '/',
430
dir.get_branch_reference())
432
def test_set_branch_reference_on_existing_reference(self):
433
"""set_branch_reference creates a branch reference"""
434
referenced_branch1 = self.make_branch('old-referenced')
435
referenced_branch2 = self.make_branch('new-referenced')
436
dir = self.make_bzrdir('source')
438
reference = dir.set_branch_reference(referenced_branch1)
439
except errors.IncompatibleFormat:
440
# this is ok too, not all formats have to support references.
441
raise TestNotApplicable("control directory does not "
442
"support branch references")
443
reference = dir.set_branch_reference(referenced_branch2)
445
referenced_branch2.bzrdir.root_transport.abspath('') + '/',
446
dir.get_branch_reference())
448
def test_set_branch_reference_on_existing_branch(self):
449
"""set_branch_reference creates a branch reference"""
450
referenced_branch = self.make_branch('referenced')
451
dir = self.make_branch('source').bzrdir
453
reference = dir.set_branch_reference(referenced_branch)
454
except errors.IncompatibleFormat:
455
# this is ok too, not all formats have to support references.
456
raise TestNotApplicable("control directory does not "
457
"support branch references")
459
referenced_branch.bzrdir.root_transport.abspath('') + '/',
460
dir.get_branch_reference())
418
462
def test_get_branch_reference_on_reference(self):
419
463
"""get_branch_reference should return the right url."""
420
464
referenced_branch = self.make_branch('referenced')
421
465
dir = self.make_bzrdir('source')
423
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
424
target_branch=referenced_branch)
467
dir.set_branch_reference(referenced_branch)
425
468
except errors.IncompatibleFormat:
426
469
# this is ok too, not all formats have to support references.
427
470
raise TestNotApplicable("control directory does not "
652
695
referenced_branch = self.make_branch('referenced')
653
696
dir = self.make_bzrdir('source')
655
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
656
target_branch=referenced_branch)
698
dir.set_branch_reference(referenced_branch)
657
699
except errors.IncompatibleFormat:
658
700
raise TestNotApplicable("format does not support branch "
672
714
referenced_tree.commit('1', rev_id='1', allow_pointless=True)
673
715
dir = self.make_bzrdir('source')
675
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
676
target_branch=referenced_tree.branch)
717
dir.set_branch_reference(referenced_tree.branch)
677
718
except errors.IncompatibleFormat:
678
719
raise TestNotApplicable("format does not support branch "
699
740
referenced_tree.commit('1', rev_id='1', allow_pointless=True)
700
741
dir = self.make_bzrdir('source')
702
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
703
target_branch=referenced_tree.branch)
743
dir.set_branch_reference(referenced_tree.branch)
704
744
except errors.IncompatibleFormat:
705
745
# this is ok too, not all formats have to support references.
706
746
raise TestNotApplicable("format does not support "
851
891
referenced_branch = self.make_branch('referencced')
852
892
dir = self.make_bzrdir('source')
854
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
855
target_branch=referenced_branch)
894
dir.set_branch_reference(referenced_branch)
856
895
except errors.IncompatibleFormat:
857
896
# this is ok too, not all formats have to support references.
858
897
raise TestNotApplicable("format does not support "
878
917
referenced_branch = self.make_branch('referencced')
879
918
dir = self.make_bzrdir('source')
881
reference = bzrlib.branch.BranchReferenceFormat().initialize(dir,
882
target_branch=referenced_branch)
920
dir.set_branch_reference(referenced_branch)
883
921
except errors.IncompatibleFormat:
884
922
# this is ok too, not all formats have to support references.
885
923
raise TestNotApplicable("format does not support "
1581
1619
master = self.make_branch('branch')
1582
1620
thisdir = self.make_bzrdir('this')
1584
bzrlib.branch.BranchReferenceFormat().initialize(
1585
thisdir, target_branch=master)
1622
thisdir.set_branch_reference(master)
1586
1623
except errors.IncompatibleFormat:
1587
1624
raise TestNotApplicable("format does not support "
1588
1625
"branch references")