Rev 6020: (jameinel) Make 'bzr branch FROM_BOUND_BRANCH' succeed without opening the in file:///home/pqm/archives/thelove/bzr/2.4/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Mon Jul 18 14:43:38 UTC 2011
At file:///home/pqm/archives/thelove/bzr/2.4/
------------------------------------------------------------
revno: 6020 [merge]
revision-id: pqm at pqm.ubuntu.com-20110718144335-8v4u0gbnwzm0vzmt
parent: pqm at pqm.ubuntu.com-20110715114231-ef2uz8fm97hr43kf
parent: john at arbash-meinel.com-20110718135852-fmx85ztlu2rxo3w2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.4
timestamp: Mon 2011-07-18 14:43:35 +0000
message:
(jameinel) Make 'bzr branch FROM_BOUND_BRANCH' succeed without opening the
master branch. (John A Meinel)
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/tests/blackbox/test_switch.py test_switch.py-20071122111948-0c5en6uz92bwl76h-1
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2011-07-15 08:25:00 +0000
+++ b/bzrlib/branch.py 2011-07-18 14:43:35 +0000
@@ -1293,11 +1293,11 @@
if repository_policy is not None:
repository_policy.configure_branch(result)
self.copy_content_into(result, revision_id=revision_id)
- master_branch = self.get_master_branch()
- if master_branch is None:
+ master_url = self.get_bound_location()
+ if master_url is None:
result.set_parent(self.bzrdir.root_transport.base)
else:
- result.set_parent(master_branch.bzrdir.root_transport.base)
+ result.set_parent(master_url)
finally:
result.unlock()
return result
=== modified file 'bzrlib/tests/blackbox/test_switch.py'
--- a/bzrlib/tests/blackbox/test_switch.py 2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/blackbox/test_switch.py 2011-07-18 13:58:52 +0000
@@ -278,6 +278,7 @@
self.run_bzr('switch --directory checkout b')
self.assertFileEqual('initial\nmore\n', 'checkout/a')
+
class TestSwitchParentLocationBase(TestCaseWithTransport):
def setUp(self):
@@ -328,3 +329,26 @@
self.assertParent('repo/trunk', bb)
self.assertParent('repo/trunk', mb)
+
+class TestSwitchDoesntOpenMasterBranch(TestCaseWithTransport):
+ # See https://bugs.launchpad.net/bzr/+bug/812285
+ # "bzr switch --create-branch" can point the new branch's parent to the
+ # master branch, but it doesn't have to open it to do so.
+
+ def test_switch_create_doesnt_open_master_branch(self):
+ master = self.make_branch_and_tree('master')
+ master.commit('one')
+ # Note: not a lightweight checkout
+ checkout = master.branch.create_checkout('checkout')
+ opened = []
+ def open_hook(branch):
+ # Just append the final directory of the branch
+ name = branch.base.rstrip('/').rsplit('/', 1)[1]
+ opened.append(name)
+ branch.Branch.hooks.install_named_hook('open', open_hook,
+ 'open_hook_logger')
+ self.run_bzr('switch --create-branch -d checkout feature')
+ # We only open the master branch 1 time.
+ # This test should be cleaner to write, but see bug:
+ # https://bugs.launchpad.net/bzr/+bug/812295
+ self.assertEqual(1, opened.count('master'))
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-07-12 23:33:11 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-07-18 14:43:35 +0000
@@ -32,6 +32,12 @@
.. Fixes for situations where bzr would previously crash or give incorrect
or undesirable results.
+* The fix for bug #513709 caused us to open a new connection when
+ switching a lightweight checkout that was pointing at a bound branch.
+ This isn't necessary because we know the master URL without opening it,
+ avoiding an extra SSH connection, etc.
+ (John Arbash Meinel, #812285)
+
Documentation
*************
More information about the bazaar-commits
mailing list