[ANN] bzr-colo 0.0.1: colocated branches using present technology
Russ Brown
pickscrape at gmail.com
Mon Jan 11 22:19:10 GMT 2010
On Sunday 10 January 2010 09:35:51 pm Neil Martinsen-Burrell wrote:
> This is to announce the initial release of the bzr-colo plugin, which
> supports the use of colocated branches using *existing* technologies in
> Bazaar. It is available at http://launchpad.net/bzr-colo or directly
> from Bazaar with a ``bzr branch lp:bzr-colo ~/.bazaar/plugins/colo``.
>
Hi,
This is really interesting stuff, and I'm having a play to see if it could fit
in with our workflow (as an option to our developers: I for one would
certainly be interested in trying it). However, I am seeing a problem relating
to switch and bound branches. This is a problem that I've also seen without
colocated branches too, so it may be a bug in core bzr itself. Either way, I'm
going to demonstrate it here in order to get some feedback.
Our workflow consists entirely of bound branches, as we like to have our work
on our central server to allow everyone to see what everyone else is doing. So
we all have a shared repository with X bound branches within it (these are
heavyweight too). Some developers switch between branches using a symlink,
while others (such as myself) use a single lightweight checkout and switch
using that. You can see at this point how colocated branches could fit in
nicely with the switch-based workflow. :)
Anyway, without getting into co-located branches yet, this demonstrates the
switch problem I mentioned earlier (I'm running bzr 2.0.3):
# Create a "remote" repository with a trunk and a branch
~/test$ bzr init-repo remote
~/test$ cd remote
~/test/remote$ bzr init trunk
Created a repository tree (format: 2a)
Using shared repository: /home/rbrown/test/remote/
~/test/remote$ bzr branch trunk branch1
Branched 0 revision(s).
~/test/remote$ cd ../
# Create local layout
~/test$ bzr init-repo local
~/test$ cd local
~/test/local$ bzr co ../remote/trunk
~/test/local$ bzr co ../remote/branch1
~/test/local$ bzr co --lightweight trunk switch
# Now see what bzr thinks of the switch branch
~/test/local$ cd switch
$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: /home/rbrown/test/local/trunk
checkout of branch: /home/rbrown/test/remote/trunk
shared repository: /home/rbrown/test/local
So switch is a lightweight checkout of (local) trunk, which is a remote
checkout of remote trunk. This works beautifully: if I commit in switch, both
the local and remote version of the branch get updated (the working trees
don't, but that isn't a problem).
# Switch to branch1
~/test/local/switch$ bzr switch ../branch1
Updated to revision 0.
Switched to branch: /home/rbrown/test/local/branch1/
~/test/local/switch$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: /home/rbrown/test/local/branch1
checkout of branch: /home/rbrown/test/remote/branch1
shared repository: /home/rbrown/test/local
Same result, but notice that I switched using a relative path rather than
simply the branch name, which switch supports. Look what happens now when I
switch by just specifying the branch name:
~/test/local/switch$ bzr switch trunk
Updated to revision 0.
Switched to branch: /home/rbrown/test/remote/trunk/
~/test/local/switch$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
checkout of branch: /home/rbrown/test/remote/trunk
shared repository: /home/rbrown/test/remote
Oops, my local branch has now been bypassed and switch has become a
lightweight checkout of the remote branch. The result is that operations
within switch are as slow as could be when the remote branch is somewhere
across the WAN (which in my case it is in the real world).
So that's the crux of my problem: why do these two produce different results,
and should they?
bzr switch trunk
bzr switch ../trunk
So anyway, back to colocated branches. Taking the same example remote
repository, let's try using colo:
~/test$ bzr colo-init colo
Shared repository (format: 2a)
Location:
shared repository: colo/.bzr/branches
Created a repository branch (format: 2a)
Using shared repository: /home/rbrown/test/colo/.bzr/branches/
~/test$ cd colo
# We're on trunk: bind it to the remote trunk
~/test/colo$ bzr bind ../remote/trunk
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: .bzr/branches/trunk
checkout of branch: /home/rbrown/test/remote/trunk
shared repository: .bzr/branches
# All good, now we want branch1.
~/test/colo$ bzr branch ../remote/branch1 colo:branch1
Branched 0 revision(s).
~/test/colo$ bzr switch colo:branch1
Tree is up to date at revision 0.
Switched to branch: /home/rbrown/test/colo/.bzr/branches/branch1/
~/test/colo$ bzr bind ../remote/branch1
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: .bzr/branches/branch1
checkout of branch: /home/rbrown/test/remote/branch1
shared repository: .bzr/branches
Related branches:
parent branch: /home/rbrown/test/remote/branch1
Exactly as expected, though I think this workflow is missing either a checkout
equivalent command or branch --bind. But moving on...
# Try switching between branches
~/test/colo$ bzr switch colo:trunk
Tree is up to date at revision 0.
Switched to branch: /home/rbrown/test/colo/.bzr/branches/trunk/
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: .bzr/branches/trunk
checkout of branch: /home/rbrown/test/remote/trunk
shared repository: .bzr/branches
~/test/colo$ bzr switch colo:branch1
Tree is up to date at revision 0.
Switched to branch: /home/rbrown/test/colo/.bzr/branches/branch1/
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
repository checkout root: .bzr/branches/branch1
checkout of branch: /home/rbrown/test/remote/branch1
shared repository: .bzr/branches
Related branches:
parent branch: /home/rbrown/test/remote/branch1
# All perfect so far! Now try using switch's shortcut and don't prefix with
colo:
~/test/colo$ bzr switch trunk
Updated to revision 0.
Switched to branch: /home/rbrown/test/remote/trunk/
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
checkout of branch: /home/rbrown/test/remote/trunk
shared repository: /home/rbrown/test/remote
Oops, there it goes deleting the link to the colocated branch! The checkout is
now completely connected to the remote repository and doesn't involve the
colocated branch at all. Look what happens when I try to switch back to
branch1 now:
~/test/colo$ bzr switch branch1
Updated to revision 0.
Switched to branch: /home/rbrown/test/remote/branch1/
~/test/colo$ bzr info
Lightweight checkout (format: 2a or development-subtree)
Location:
light checkout root: .
checkout of branch: /home/rbrown/test/remote/branch1
shared repository: /home/rbrown/test/remote
Related branches:
parent branch: /home/rbrown/test/remote/trunk
submit branch: /home/rbrown/test/remote/branch1
Still connecting directly to remote... What happens if I specify colo:?
~/test/colo$ bzr switch colo:trunk
bzr: ERROR: Invalid url supplied to transport: "colo:trunk": Not in a
colocated workspace
Oh dear, it looks like it's basically broken now. I'm not entirely sure what
I'd need to do to go about rescuing this colo now...
As I say, I think that this is a core bzr problem rather than a problem with
colo per se, and I think this plugin is really interesting and is something
that I look forward to in the future.
Should I raise a bug about this switch problem, or is it intended behaviour?
Thanks.
--
Russ
More information about the bazaar
mailing list