One of the things I love is reviewing smaller targeted branches – 400-500 lines focused on one or two particular points. But you don’t want to be blocked on the review of one branch to start the next dependent branch. Here’s a quick screencast (with text version below) that I made for some colleagues showing how Bzr’s pipeline plugin can help your workflow in this situation:
Assuming you’ve already got a lightweight checkout of your project code, create a new branch for part-1 of your feature and switch to it:
$ bzr branch trunk part-1
$ cd current_work;bzr switch ../part-1
Make your changes, commit and push to Launchpad:
$ bzr commit -m "Finished part 1 of feature-x that does x, y and z";bzr push
While that branch is being reviewed, you can start on the next part of the feature:
$ bzr add-pipe part-2
Created and switched to pipe "part-2"
$ bzr pipes
Now make your further changes for the feature and commit/push those as above (Launchpad will create a new branch for part-2). Now let’s say that the review for part-1 comes back, requiring a small change, so we switch back to part-1, make the change, commit and pump it (so that our part-2 branch will include the change also):
$ bzr switch part-1
$ bzr pipes
$ bzr commit -m "Changes from review";bzr pump
Now we can see the changes have been merged into the part-2 branch:
$ bzr switch part-2
$ bzr log --limit 1 --line
102: Michael Nelson 2011-01-13 [merge] Merged part-1 into part-2.
So, let’s say we’re now ready to submit part-2 for review. The handy lp-submit bzr plugin will automatically know to set part-1 as a prerequisite branch, so that the diff shown on the part-2 merge proposal includes only the changes from part-2 (as well as making sure that your branches are pushed up to LP):
$ bzr lp-submit
Pushing to lp:~michael.nelson/rnr-server/part-1
Pushing to lp:~michael.nelson/rnr-server/part-2
Nice! Now, what if there have been some changes to trunk in the mean-time that you want to include in your branch? Easy, just:
$ bzr pump --from-submit
and pipelines will automatically merge trunk into part-1, commit, then merge part-1 into part-2.
More info with `bzr help pipeline` (once it’s installed), or more information (including how to get it) on the Bazaar Pipeline wiki page.
Filed under: bzr