Idiomatic working

Neil Martinsen-Burrell nmb at
Tue Jul 14 17:44:09 BST 2009

On 2009-07-14 08:49 , Guy Gascoigne-Piggford wrote:
> I guess I'm still rather confused.  What exactly is the difference
> between creating your upstream mirror (and I'm not at all sure that I'm
> not implying something that I don't mean by using that word) as a bound
> branch or as a checkout.  I use the checkout and I'm pretty comfortable
> with what it does and how it works, but I keep hearing about mirror
> branches and bound branches and suspect that I'm missing a useful
> technique here.

A checkout and a bound branch are functionally identical.  In both 
cases, every commit made is first made in the branch to which they are 
bound.  In addition, to even start a commit, the checkout or bound 
branch must be up to date with the branch to which it is bound. 
Consider the following example::

nmb at guttle[/tmp]$ bzr init trunk
Created a standalone tree (format: pack-0.92)
nmb at guttle[/tmp]$ bzr branch trunk bound_branch
Branched 0 revision(s).
nmb at guttle[/tmp]$ cd bound_branch
nmb at guttle[/tmp/bound_branch]$ bzr bind trunk
bzr: ERROR: Not a branch: "/private/tmp/bound_branch/trunk/".
nmb at guttle[/tmp/bound_branch]$ bzr bind ../trunk
nmb at guttle[/tmp/bound_branch]$ bzr info
Checkout (format: pack-0.92)
        checkout root: .
   checkout of branch: /private/tmp/trunk

Related branches:
   parent branch: /private/tmp/trunk
nmb at guttle[/tmp/bound_branch]$ cd ..
nmb at guttle[/tmp]$ bzr checkout trunk checkout
nmb at guttle[/tmp]$ cd checkout
nmb at guttle[/tmp/checkout]$ bzr info
Checkout (format: pack-0.92)
        checkout root: .
   checkout of branch: /private/tmp/trunk

The only difference is that creating a branch like this (which some 
people call a mirror branch because of the tight coupling between this 
branch and the one to which it is bound) by branching and then binding 
is that the parent branch is set on one but not the other.  This has one 
minor effect::

nmb at guttle[/tmp/checkout]$ cd ../bound_branch
nmb at guttle[/tmp/bound_branch]$ bzr unbind
nmb at guttle[/tmp/bound_branch]$ bzr pull
Using saved parent location: /private/tmp/trunk/
No revisions to pull.
nmb at guttle[/tmp/bound_branch]$ cd ../checkout
nmb at guttle[/tmp/checkout]$ bzr unbind
nmb at guttle[/tmp/checkout]$ bzr pull
bzr: ERROR: No pull location known or specified.

In bzr 2.0, some of these concepts will be changing as checkout will 
refer only to what are now called "lightweight checkouts" and the 
corresponding structure with complete history will be called a "bound 
branch".  See for more 
details on this change.

I don't think that you are missing out on any magical functionality. 
Bound branches and checkouts should behave the same and a "mirror 
branch" is just a name that people use for a Bazaar branch that is 
intended to be a perfect local copy of another branch.


More information about the bazaar mailing list