Using Bazaar to work on Drupal core patches

As anyone who’s developed core patches knows, it’s not the writing of initial patch that takes the work, it’s the combination of revising the patch and keeping up to date with HEAD. With Drupal.org’s CVS, this is difficult because you cannot commit your core changes to checkpoint your work. CVS’s merge algorithms are also relatively poor for maintaining large divergence from CVS HEAD.

One option — which several community members used to create the huge DB-TNG patch — was to create a Subversion repository. This is far too much overhead for smaller core patches, and it still required person-by-person approval to commit to the Subversion repository.

Four Kitchens is now hosting a much more flexible system for users of Bazaar. Every hour, we synchronize core changes from CVS HEAD into our Drupal 7 branch, which is available for anonymous branching by anyone.

Simply download and install Bazaar, which has packages or installers for Linux, Windows, Mac OS X, and BSD. We’re using a repository format that should work with Bazaar 1.0 and newer, at a minimum.

Then, when you’re ready to develop, create a local branch and make its new directory your working directory.

Then, where you’re ready to develop, run this:
bzr branch bzr://vcs.fourkitchens.com/drupal/7 [optional-working-copy-directory]

You’ll have a fresh working copy with a number of benefits over a CVS checkout:

  • You can commit to your local branch to checkpoint your work: bzr commit
  • You can integrate in changes to HEAD using Bazaar’s superior merge algorithms:
    bzr merge
  • You can branch from your own branch: bzr branch [existing] [new]
  • If you’re working with others and they have Bazaar branches, too, you can merge from their branches to collaborate.

And when you’re ready to post a patch, run
bzr diff --old bzr://vcs.fourkitchens.com/drupal/7-all-history > mypatch.patch
to create a patch reflecting all of your changes relative to CVS HEAD.

And when you’re ready to post a patch, run bzr diff --old bzr://vcs.fourkitchens.com/drupal/7 to create a patch reflecting all of your changes relative to CVS HEAD.

It will be a while before Drupal.org moves to anything other than CVS. Until then, we can foster decentralized development quite effectively using something like the Four Kitchens repository.

Note (2009-12-07): Yes, I realize Launchpad has a similar service that stores more detailed revision data, but I often find Launchpad slow or unresponsive. We also maintain Bazaar branches of stable Drupal 5 and 6; just replace the “7” above with “5” or “6”.

Note (2009-02-09): I have updated this post to use the new Bazaar branch for Drupal HEAD. We also maintain Bazaar branches of stable Drupal 5 and 6; just replace the “7-all-history” above with “5” or “6”. All obsolete information is now crossed out and replaced. I’ve maintained the obsolete instructions in case anyone is actively using them; they will continue to function.

Commenting on this Blog post is closed.

Comments

Does Four Kitchens or Launchpad also import all the contrib modules to bazaar?

We don’t right now. It would be possible for us to make a Bazaar branch based on core branches (like DRUPAL-6—1) or HEAD, but there’s no consistent way for us to pull stable module releases, which are managed with tags and the projects module on Drupal.org.

very cool. I’ve used bazaar on one project so far, and it does take a bit of getting used to. The question of “why bazaar instead of svn/cvs?” comes up a lot, and I think you’ve given an excellent example. Thanks for making this available to the public too!****

It seems that the bazaar install on Debian etch doesn’t support the bzr:// prefix. Is it reachable via http?

You’ll need 0.92 or newer to use the Four Kitchens branch. What version are you running?

Bazaar (bzr) 0.11.0
That’s the current version on Debian Etch.

Bazaar 0.11.0 is very old. I would have to use an obsolete branch format to support that release. You can update your Bazaar packages in Debian from Backports.org’s repository.

Thanks for this informative and well written article. Though I have already found tones of info at the search engine on ebooks, your article was a real pleasure to read.

I had a desire to start my business, but I didn’t have got enough amount of money to do this. Thank goodness my colleague recommended to take the mortgage loans. Thus I used the sba loan and realized my dream.