In the Exaile project, we use Bazaar as we used Subversion before (with one central repository that everyone commits to). This post explains the local repository setup and the daily workflow that works best for me and matches the overall project workflow. It may not be perfect for other people or other projects.
One of my biggest problems with Subversion is its lack of local commits (which is why I use SVK for Subversion projects that I contribute to, but I digress). Distributed revision control systems like Bazaar and SVK do not have this problem. I normally have two branches on my machine: one for my work area and one as the mainline/trunk copy (so I can compare my work with the mainline version easily). I make changes in the work branch, do as many commits, rollbacks, etc. as I need to, and when I’m finished I push all the changes to the main branch, and from there push it to the remote repository. This is basically the workflow promoted by SVK.
In SVK, the “main” branch would be a mirror of the remote repository; any commits there are immediately propagated to the remote repo. This means that the second push, from my local mirror to the remote repo, is unnecessary. I wanted something like that in Bazaar; pushing changes twice gets annoying after some time. Then it hit me that SVK’s mirror is basically very similar to Bazaar’s checkout (a.k.a. bound branch). I simply turned my main branch into a checkout (using bzr bind), and now it works perfectly the way I want it to.
This is the complete setup of my local repository:
$ bzr init-repo exaile $ cd exaile $ bzr co lp:exaile main $ bzr branch main work
My daily workflow goes like this:
$ bzr up main $ cd work $ bzr pull ../main $ vi exaile.py $ bzr ci -m "Fix bug 1000." $ vi exaile.py $ bzr ci -m "Fix bug 1001." $ bzr push ../main
If the remote repository has been modified since I updated it,
$ cd ../main $ bzr up $ bzr merge ../work $ bzr ci -m "Merge."