30
30
from bzrlib.tests import (
36
from bzrlib.tests.blackbox import test_switch
35
37
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
36
38
from bzrlib.tests.script import run_script
37
39
from bzrlib.urlutils import local_path_to_url, strip_trailing_slash
535
537
2>The command 'bzr %(command)s' has been deprecated in bzr 2.4. Please use 'bzr branch' instead.
536
538
2>bzr: ERROR: Not a branch...
542
class TestBranchParentLocation(test_switch.TestSwitchParentLocationBase):
544
def _checkout_and_branch(self, option=''):
545
self.script_runner.run_script(self, '''
546
$ bzr checkout %(option)s repo/trunk checkout
548
$ bzr branch --switch ../repo/trunk ../repo/branched
549
2>Branched 0 revision(s).
550
2>Tree is up to date at revision 0.
551
2>Switched to branch:...branched...
554
bound_branch = branch.Branch.open_containing('checkout')[0]
555
master_branch = branch.Branch.open_containing('repo/branched')[0]
556
return (bound_branch, master_branch)
558
def test_branch_switch_parent_lightweight(self):
559
"""Lightweight checkout using bzr branch --switch."""
560
bb, mb = self._checkout_and_branch(option='--lightweight')
561
self.assertParent('repo/trunk', bb)
562
self.assertParent('repo/trunk', mb)
564
def test_branch_switch_parent_heavyweight(self):
565
"""Heavyweight checkout using bzr branch --switch."""
566
bb, mb = self._checkout_and_branch()
567
self.assertParent('repo/trunk', bb)
568
self.assertParent('repo/trunk', mb)