However, it does meet the most important criteria: It just works for me.
Now for the big disclaimer: Most of the projects I use bzr to manage fall into 1 of 2 categories:
- Projects with small teams (1-4 developers)
- Public projects where I just want to grab the source and maybe maintain some local patches
If I needed to somehow manage a project with dozens or hundreds of contributors (like Gnome or the Linux Kernel), git would probably look a lot more appealing to me. After all, it was designed for large code bases with lots of contributors and branches.
I’ve seen lots of git cookbooks popping up lately, so I thought I’d explain my bzr workflow for the 2 use cases I list above.
1. Starting and sharing a project with a small team
Prerequisite: You’ve created a directory with some code in it.
Turn your source code directory into a bzr repository:
~/src/foo$ bzr init
Add you source files:
~/src/foo$ bzr add
~/src/foo$ bzr ci
Push my changes to a remote location* other team members can access:
~/src/foo$ bzr push –remember sftp://some/file/server
Done! My favorite part is that besides the
--remember option, bzr just does what you expect without any flags or configuring. The
--remember option simply tells bzr to use that location for future
push commands (so you can drop all the typing after “push”).
For more information check out the excellent bazaar documentation on sharing code.
2. Getting the code for an open source project
Unfortunately most big bzr-hosted projects are on Launchpad which makes for a pretty boring demonstration:
~/src$ bzr branch lp:terminator # yawn
To make matters worse, non-Launchpad hosted projects are nearly as dull:
~/src$ bzr branch http://bzr.savannah.gnu.org/r/gnash/trunk
In each case bzr will create a new directory for you using the last part of the source path (terminator & trunk respectively). You can optionally give it a second argument to put the branch in a different location. The destination can even be a remote server!
~/src$ bzr branch http://source/branch sftp://destination/branch
Ok now I’m just showing off. I’ve never found a use for that feature. 😉 However, I do appreciate that a location is a location to bzr regardless of whether that location is the local filesystem or a remote server. It just works how you’d expect it.
Chapters 4-6 of Bazaar’s documentation give some excellent examples of various collaboration workflows.
Bonus Feature: Subversion mode!
So its not really Subversion mode, but bzr does support pulling repositories via the
checkout command and updating your working copy from the remote repository via the
update command just like Subversion. As you would expect, the
commit now sends changes directly to the remote server.
While I’ve used this feature mainly to make transitioning to bzr easier for Subversion users, Bazaar’s documentation has some excellent techniques for making advanced workflows easier using checkouts.
- ** SSH Tips:
- bzr+ssh is faster than plain old sftp but requires bzr to be installed on the server.
- Setup ssh connection multiplexing using
~/.ssh/configand leave an ssh session active to speed up bzr operations.