~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-07-18 17:20:33 UTC
  • mfrom: (6031.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20110718172033-l9zmherfao7q80yp
(jam) Merge lp:bzr/2.4 into lp:bzr after fixing up release-notes

Show diffs side-by-side

added added

removed removed

Lines of Context:
278
278
        self.run_bzr('switch --directory checkout b')
279
279
        self.assertFileEqual('initial\nmore\n', 'checkout/a')
280
280
 
 
281
 
281
282
class TestSwitchParentLocationBase(TestCaseWithTransport):
282
283
 
283
284
    def setUp(self):
328
329
        self.assertParent('repo/trunk', bb)
329
330
        self.assertParent('repo/trunk', mb)
330
331
 
 
332
 
 
333
class TestSwitchDoesntOpenMasterBranch(TestCaseWithTransport):
 
334
    # See https://bugs.launchpad.net/bzr/+bug/812285
 
335
    # "bzr switch --create-branch" can point the new branch's parent to the
 
336
    # master branch, but it doesn't have to open it to do so.
 
337
 
 
338
    def test_switch_create_doesnt_open_master_branch(self):
 
339
        master = self.make_branch_and_tree('master')
 
340
        master.commit('one')
 
341
        # Note: not a lightweight checkout
 
342
        checkout = master.branch.create_checkout('checkout')
 
343
        opened = []
 
344
        def open_hook(branch):
 
345
            # Just append the final directory of the branch
 
346
            name = branch.base.rstrip('/').rsplit('/', 1)[1]
 
347
            opened.append(name)
 
348
        branch.Branch.hooks.install_named_hook('open', open_hook,
 
349
                                               'open_hook_logger')
 
350
        self.run_bzr('switch --create-branch -d checkout feature')
 
351
        # We only open the master branch 1 time.
 
352
        # This test should be cleaner to write, but see bug:
 
353
        #  https://bugs.launchpad.net/bzr/+bug/812295
 
354
        self.assertEqual(1, opened.count('master'))