[MERGE] `bzr switch` now finds the sibling of the bound branch of a heavy checkout when passed a location that does not immediately resolve to a branch.

Aaron Bentley aaron at aaronbentley.com
Sat Sep 20 18:41:33 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

bb:approve

I'll merge this one, but there are some cleanups I'd like to suggest for
a followup.

Adrian Wilkins wrote:
> Improved comments and documentation, and used urlutils.join as suggested.

> === modified file 'bzrlib/tests/blackbox/test_switch.py'
> --- bzrlib/tests/blackbox/test_switch.py	2008-03-03 11:35:47 +0000
> +++ bzrlib/tests/blackbox/test_switch.py	2008-08-07 09:12:47 +0000
> @@ -62,4 +62,23 @@
>          self.assertEqual(branchb_id, checkout.last_revision())
>          checkout = checkout.bzrdir.open_workingtree()
>          self.assertEqual(tree2.branch.base, checkout.branch.base)
> -        
> +
> +    def test_switch_finds_relative_bound_branch(self):
> +        """Using switch on a heavy checkout should find master sibling
> +
> +        The behaviour of lighweight and heavy checkouts should be 
> +        consistentwhen using the convenient "switch to sibling" feature
> +        Both should switch to a sibling of the branch
> +        they are bound to, and not a sibling of themself"""
> +
> +        self.build_tree(['repo/',
> +                         'heavyco/'])
> +        tree1 = self.make_branch_and_tree('repo/brancha')
> +        tree1.commit('foo')
> +        tree2 = self.make_branch_and_tree('repo/branchb')
> +        tree2.pull(tree1.branch)
^^^ The usual way of branching in tests is:
tree2 = tree1.bzrdir.sprout('repo/branchb').open_workingtree()


> +        branchb_id = tree2.commit('bar')
> +        checkout = tree1.branch.create_checkout('heavyco/a', lightweight=False)

^^^ It would be nice to see that switch fails if it is a branch, but
succeeds if it is a checkout.  e.g.

tree3 = tree1.bzrdir.sprout('heavyco/a').open_workingtree()
self.run_bzr(['switch', 'branchb'], working_dir='heavyco/a', retcode=1)
tree3.branch.bind(tree1.branch)
self.run_bzr(['switch', 'branchb'], working_dir='heavyco/a')

etc...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI1TXN0F+nu1YWqI0RAolqAJ4s0aroElUy/Yesxi7X6wl1NGqGwACfT6UT
kxW8nbsY45jo/gaBLr5u9OA=
=JqaC
-----END PGP SIGNATURE-----



More information about the bazaar mailing list