~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_switch.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
        self.assertContainsRe(err, 'Updated to revision 1.\n')
49
49
        self.assertContainsRe(err, 'Switched to branch: .*/branch2.\n')
50
50
        self.assertEqual('', out)
 
51
 
 
52
    def test_switch_finds_relative_branch(self):
 
53
        """Switch will find 'foo' relative to the branch that the checkout is of."""
 
54
        self.build_tree(['repo/'])
 
55
        tree1 = self.make_branch_and_tree('repo/brancha')
 
56
        tree1.commit('foo')
 
57
        tree2 = self.make_branch_and_tree('repo/branchb')
 
58
        tree2.pull(tree1.branch)
 
59
        branchb_id = tree2.commit('bar')
 
60
        checkout =  tree1.branch.create_checkout('checkout', lightweight=True)
 
61
        self.run_bzr(['switch', 'branchb'], working_dir='checkout')
 
62
        self.assertEqual(branchb_id, checkout.last_revision())
 
63
        checkout = checkout.bzrdir.open_workingtree()
 
64
        self.assertEqual(tree2.branch.base, checkout.branch.base)
 
65