`bzr switch -b xxx` creates new branch first then failed with error: Cannot switch a branch, only a checkout.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Confirmed
|
Low
|
Unassigned |
Bug Description
Steps to reproduce: create standalone branch, then try to execute `bzr switch -b` in there.
C:\Temp\8>bzr init a
Created a standalone tree (format: 1.9)
C:\Temp\8>cd a
C:\Temp\8\a>
C:\Temp\8\a>bzr mkdir foo
added foo
C:\Temp\8\a>bzr ci -m1
Committing to: C:/Temp/8/a/
added foo
Committed revision 1.
C:\Temp\8\a>bzr switch -b spam
bzr: ERROR: Cannot switch a branch, only a checkout.
At this point bzr has created new branch "spam" in the parent directory of original branch (a).
C:\Temp\8\spam>bzr info
Standalone tree (format: 1.9)
Location:
branch root: .
Related branches:
parent branch: C:/Temp/8/a
I think bzr should not create new branch and should check for type of original branch first and fail early with error: Cannot switch a branch, only a checkout.
Because in the case of branch with big and heavy history this is very long and wasteful process.
Changed in bzr: | |
importance: | Undecided → Low |
status: | New → Confirmed |
tags: | added: colocated |
tags: | added: check-for-breezy |
So in bzr 2.5b5, I do get the error bialix asks for, "BzrCommandError: Cannot switch a branch, only a checkout", and I think the bug as originally filed is fixed... but...
When I did `bzr switch -b` in a newly created development-colo branch, as jelmer recommended in his "call for testing of colocated branch support":
0.121 Traceback (most recent call last): python2. 7/dist- packages/ bzrlib/ commands. py", line 919, in exception_ to_return_ code python2. 7/dist- packages/ bzrlib/ commands. py", line 1124, in run_bzr python2. 7/dist- packages/ bzrlib/ commands. py", line 672, in run_argv_aliases **all_cmd_ args) python2. 7/dist- packages/ bzrlib/ commands. py", line 694, in run .run_simple( *args, **kwargs) python2. 7/dist- packages/ bzrlib/ cleanup. py", line 136, in run_simple python2. 7/dist- packages/ bzrlib/ cleanup. py", line 166, in _do_with_cleanups python2. 7/dist- packages/ bzrlib/ builtins. py", line 6187, in run switch( control_ dir, to_branch, force, revision_ id=revision) python2. 7/dist- packages/ bzrlib/ switch. py", line 48, in switch branch_ location( control_ dir, to_branch, force) python2. 7/dist- packages/ bzrlib/ switch. py", line 110, in _set_branch_ location BzrCommandError (gettext( 'Cannot switch a branch, '
File "/usr/lib/
return the_callable(*args, **kwargs)
File "/usr/lib/
ret = run(*run_argv)
File "/usr/lib/
return self.run(
File "/usr/lib/
return self._operation
File "/usr/lib/
self.cleanups, self.func, *args, **kwargs)
File "/usr/lib/
result = func(*args, **kwargs)
File "/usr/lib/
switch.
File "/usr/lib/
_set_
File "/usr/lib/
raise errors.
BzrCommandError: Cannot switch a branch, only a checkout.
... perhaps this hinges on it being a branch inside a repository directory?
When I tried 'switch' again in trunk, it seems to work, and indeed the code there has recently changed.
However, on bzr trunk tip, it works for colos, but following the original reproduction instructions with plain branches gives a different error:
mbp@joy% cd ~/tmp tmp/601922/ a/ tmp/601922/ a/ //home/ mbp/tmp/ 601922/ a/,branch= spam/'> does not support co-located branches.
mbp@joy% mkchdir 601922
mbp@joy% bzr.trunk init a
Created a standalone tree (format: 2a)
mbp@joy% bzr
mbp@joy% cd a
mbp@joy% bzr.trunk mkdir foo
added foo
mbp@joy% bzr.trunk ci -m1
Committing to: /home/mbp/
added foo
Committed revision 1.
mbp@joy% bzr.trunk switch -b spam
Tree is up to date at revision 1.
Switched to branch: /home/mbp/
mbp@joy% bzr info
bzr: ERROR: <BzrDirMeta1 at 'file:/