Rev 6018: Bug #812285. Add an effort test to show that things have improved. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-no-open-master

John Arbash Meinel john at arbash-meinel.com
Mon Jul 18 13:59:53 UTC 2011


At http://bazaar.launchpad.net/~jameinel/bzr/2.4-no-open-master

------------------------------------------------------------
revno: 6018
revision-id: john at arbash-meinel.com-20110718135852-fmx85ztlu2rxo3w2
parent: john at arbash-meinel.com-20110712121417-loafgcunqldhwbcf
fixes bug(s): https://launchpad.net/bugs/812285
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-no-open-master
timestamp: Mon 2011-07-18 15:58:52 +0200
message:
  Bug #812285. Add an effort test to show that things have improved.
  We still open the master branch 1 time, but at least we don't do it twice.
-------------- next part --------------
=== 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 12:14:17 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-07-18 13:58:52 +0000
@@ -36,7 +36,7 @@
   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)
+  (John Arbash Meinel, #812285)
 
 Documentation
 *************



More information about the bazaar-commits mailing list