[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
Tue Aug 5 16:38:03 BST 2008


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

bb:resubmit

Adrian Wilkins wrote:
>          except errors.NotBranchError:
> +            this_branch = control_dir.open_branch()
> +            this_url = this_branch.get_bound_location()
> +            # This might be a heavyweight checkout

^^^ This comment seems to apply to the previous line.  Comments are
usually above the code they refer to.

> +            if this_url is None:
> +                this_url = this_branch.base
>              to_branch = Branch.open(
> -                control_dir.open_branch().base + '../' + to_location)
> +                this_url + '../' + to_location)

^^^ I'd like to see proper url manipulation here, not string
concatenation.  I suggest either urlutils.join or Transport.clone()

> === 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-04 14:27:39 +0000
> @@ -62,4 +62,18 @@
>          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):
> +        """switch should find the sibling of the bound branch for a heavy checkout
> +        rather than attempt to find a local sibling"""

^^^ Docstrings should have a single-line summary, then blank line, then
additional description (if needed).

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

iD8DBQFImHPa0F+nu1YWqI0RApXvAJ9MTCen9wjs0wbnLS/huHVJ+fLexQCfR+x+
Qj7+yAP5K2NdB2Pp0X79QK0=
=8Lkb
-----END PGP SIGNATURE-----



More information about the bazaar mailing list