notbrancherror blocks switch away from a deleted branch

Bug #937420 reported by Martin Pool
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Confirmed
Medium
Unassigned

Bug Description

If for some reason you have a checkout of a branch that's now deleted, you'll get a NotBranchError if you try to switch away from it, which is unfortunate:

Tue 2012-02-21 15:48:23 +1100
0.052 bazaar version: 2.6.0dev1
0.052 bzr arguments: [u'switch', u'remove-bsondump']
0.053 looking for plugins in /home/mbp/.bazaar/plugins
0.097 looking for plugins in /home/mbp/bzr/trunk/bzrlib/plugins
0.097 Plugin name launchpad already loaded
0.098 looking for plugins in /usr/lib/python2.7/dist-packages/bzrlib/plugins
0.098 Plugin name bash_completion already loaded
0.098 Plugin name changelog_merge already loaded
0.098 Plugin name launchpad already loaded
0.098 Plugin name netrc_credential_store already loaded
0.098 Plugin name news_merge already loaded
0.098 Plugin name po_merge already loaded
0.098 Plugin name weave_fmt already loaded
0.101 encoding stdout as sys.stdout encoding 'UTF-8'
0.119 Transferred: 0kB (0.0kB/s r:0kB w:0kB)
0.121 Traceback (most recent call last):
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 930, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 1141, in run_bzr
    ret = run(*run_argv)
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 673, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/mbp/bzr/trunk/bzrlib/commands.py", line 697, in run
    return self._operation.run_simple(*args, **kwargs)
  File "/home/mbp/bzr/trunk/bzrlib/cleanup.py", line 136, in run_simple
    self.cleanups, self.func, *args, **kwargs)
  File "/home/mbp/bzr/trunk/bzrlib/cleanup.py", line 166, in _do_with_cleanups
    result = func(*args, **kwargs)
  File "/home/mbp/bzr/trunk/bzrlib/builtins.py", line 6257, in run
    switch.switch(control_dir, to_branch, force, revision_id=revision)
  File "/home/mbp/bzr/trunk/bzrlib/switch.py", line 43, in switch
    _check_pending_merges(control_dir, force)
  File "/home/mbp/bzr/trunk/bzrlib/switch.py", line 69, in _check_pending_merges
    raise ex
NotBranchError: Not a branch: "/home/mbp/launchpad/lp-branches/work/.bzr/branches/936762-setuplxc-shell/".

It might be better if bzr just warned you the old branch was gone and switched without checking, or something like that.

Revision history for this message
Martin Pool (mbp) wrote :

using --force makes the switch work, so this bug could be closed by just giving you a clean error suggesting you should use it

Revision history for this message
John A Meinel (jameinel) wrote :

"branch that's not deleted" do you mean a "branch that's *now* deleted" ?

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 937420] Re: notbrancherror blocks switch away from a deleted branch

yes

John A Meinel (jameinel)
description: updated
Jelmer Vernooij (jelmer)
tags: added: check-for-breezy
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.