understanding some of the basics

Neil Martinsen-Burrell nmb at wartburg.edu
Sat Oct 16 01:37:53 BST 2010


On 2010-10-15 15:25 , John Gabriele wrote:
> I have a handful of basic questions I was hoping to find answers to
> while I slowly make sense of Bazaar :) :
>
>    * Is it customary to have just one repository at the top of a given
> working tree (so, one `.bzr` dir in my project dir, say,
> `/home/john/the-proj`)?

Yes, most people prefer that.  It is also possible to have a single 
repository that covers multiple projects (say ``bzr init-repo /home/john``).

>    * Is it typical to have more than one branch in a given working tree
> -- such that one can switch at-will between branches, or merge one
> branch into another -- all within the same working tree (and
> repository)?

This is not currently the typical way to use Bazaar.  The common setup 
is to have one branch per directory tree.  Many developers have noticed 
that this is inefficient and there are a number of different ways of 
addressing that lack: treeless branches and colocated branches.  I'll 
plug the colocated branch model that uses my bzr-colo plugin (``bzr 
branch lp:bzr-colo ~/.bazaar/plugins/colo``) and answer the remainder of 
your questions as if you were using that plugin.

>        * If that's correct, what is the command to switch from one
> branch (say, named/tagged "works-ok") to another (say,
> "adding-crazy-feature") -- both of them within my single working tree?

You can refer to named branches using the syntax colo:name with Bazaar's 
ordinary switch command, which can also be used to switch to branches 
located at other paths and other URLs.  For example, ``bzr switch 
colo:adding-crazy-feature``.

>        * What is the command to merge one branch
> ("adding-crazy-feature") into another branch ("works-ok") both of
> which are in the same working tree?

Switch to the target branch and then use the merge command with a branch 
referred to by colo:name: ``bzr switch colo:works-ok; bzr merge 
colo:adding-crazy-feature``.

>    * If my friend (on the same machine, at `/home/zoidberg`) wants to
> make his own working tree / fork of the-proj (say, starting with my
> "works-ok" branch) to add some crazy feature of his own (maybe
> creating a new branch of his own called "auto-shell-molt"), but wants
> to do so in his own project dir (`/home/zoidberg/the-proj`), is his
> branch logically the same as mine ("adding-crazy-feature") only it
> happens to be in a separate and distinct working tree and repository?

Yes.  Until he commits new revisions to his branch, then his branch is 
identical to yours, although it lives in a different location.

>    * And finally (for now), are the commands for manipulating branches
> within the same working-tree/repository different from those for
> manipulating branches which are in separate
> working-trees/repositories? If so, can someone please summarize which
> are used for which?

If you use the bzr-colo plugin, then all of the commands for operating 
specifically on the colocated branch structures are prefixed with 
"colo-".  All of Bazaar's ordinary commands can work on colocated 
branches using the "colo:" specifier.  For more information, do ``bzr 
help colo``.

-Neil



More information about the bazaar mailing list