Tuesday, February 05, 2008

Bazaar

Okay, a guy I work with, Jon, told me about Bazaar (bzr), which is a version control system. I've been trying it out for several weeks, using at work regularly, and just playing with it at home. I've really come to like it a lot except for one shortcoming noted below.

The web site does a good job of listing the features but here are the ones that I like.

  • Commands are similar to CVS.
  • You don't need a central repository.
  • It's completely written in Python and supports plug-ins.
  • It's very easy to use.
My first version control system was RCS and then around early in this century I migrated to CVS, which was descended from RCS. This will be my third. (Well, not technically. I have used and do use others).

One big paradigm shift involves how version numbers are assigned. In CVS, each file has it's own series of version numbers. For example file1 might be at version 1.4 and file2 might be at 1.20. The only idea of a global version is achieved with tags.

With bzr, even if you only commit changes from file2, if that's version 25, then version 25 represents the state of all files in the project at that point. This has a few implications.
  1. If you list the log of changes for, e.g., file2, you might see it was updated in versions 25, 23, 22, 10, and 7.
  2. You can list the global log of changes which shows comments and which files were changed for ever version number.
  3. It's trivially easy to commit changes since you don't have to list files, but can just do a commit which catches everything. This is more convenient than I ever imagined.
This idea of a global version number rather than a local version number for each file is the way most version control systems work so this represents a paradigm shift for me (hey, a change in thinking!) but I've quickly come to like it.

Bazaar has one shortcoming that is very annoying—it doesn't support RCS keywords. In RCS, you can place text like $Revision$, $Author$, and $Date$ in your file and they will be updated with the current values. I've depended on this over the years and miss it a lot when it's missing. I think files should have their identifying information when printed without having to refer to the on-line version control system.

It's pretty easy to write a little program that edits in this information, say just before committing changes, and indeed I've already written most of it. It could even be made a plugin for Bazaar so I may do that.

In the end, Bazaar is highly recommended for keeping versions of any important files (not just program code).