'bzr switch' opens too many branches too many times

Bug #812295 reported by John A Meinel
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Low
Unassigned
Breezy
Triaged
Low
Unassigned

Bug Description

I just wrote an effort test for 'bzr switch --create-branch' to make sure we didn't open master branch multiple times.

It turns out that we open things *way* too much. Without my fix, we open the checkout branch 10 times, master branch 2 times, and the target branch 3 times.

    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
            opened.append(branch.base.rstrip('/').rsplit('/', 1)[1])
        branch.Branch.hooks.install_named_hook('open', open_hook,
                                               'open_hook_logger')
        self.run_bzr('switch --create-branch -d checkout feature')
        self.assertEqual(['checkout', 'feature'], opened)

b = ['checkout',
 'checkout',
 'checkout',
 'checkout',
 'checkout',
 'checkout',
 'feature',
 'master',
 'feature',
 'checkout',
 'checkout',
 'checkout',
 'master',
 'feature',
 'checkout']

In theory, we should only open each branch one time. This is capturing Branch.__init__ calls. (via the Branch.open hook).

Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
Jelmer Vernooij (jelmer)
tags: removed: check-for-breezy
Changed in brz:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.