Contributing as a Non-Committer using Bazaar

bzr is one of the current generation of distributed version control systems (DVCS).

How-to: Branch using the Bazaar mirror

Many Zope projects have a “mirror” of the trunk of their Subversion repository as a Bazaar branch on Launchpad:

https://code.launchpad.net/zopetoolkit

https://code.launchpad.net/zope

The mirror is updated periodically as commits are made to the SVN repository. You can create a branch from the URLs there as with any other web-hosted Bazaar branch:

$ bzr branch https://code.launchpad.net/zope.event event-trunk

In many cases, this can be shortened to:

$ bzr branch lp:zope.event

How-to: Branch with Bazaar directly from Subversion

Recent versions of bzr and the bzr-svn plugin allow the developer to interoperate with a project whose main repository is in Subversion. Using this plugin, you can check out the branch from its native HTTP URL:

$ cd ~/zope
$ bzr branch svn://svn.zope.org/repos/main/zope.event/trunk event-trunk

Inside that branch, you can commit as usual using bzr, but you won’t be able to bzr push the code back to Subversion unless you use an svn+ssh checkout URL, which requires obtaining commit access to the repository (see Becoming a Committer).

Because all Zope projects are hosted in a centralized repository, the DVCS needs to pull down lots of information about revisions which aren’t directly related to the branch you want to work on. In order to keep this overhead down, especially if you plan to work on multiple Zope projects, you can create a “shared repository” for your branches before checking any of them out:

$ mkdir ~/zope
$ cd ~/zope
$ bzr init-repo
$ bzr branch lp:zope.event

How-to: Submit a patch from your Bazaar branch

From your Bazaar branch, you can use bzr diff to create a patch file, and then submit it just as in How-to: Submit a patch from your Subversion checkout.

Bazaar has another feature, bzr send, which you can use to automate submitting the patch, either via e-mail:

$ bzr send --message="Cool feature" --mail-to=maintainer@example.com

or as a file to be uploaded to the bug tracker:

$ bzr send --message="Cool feature" -o /tmp/zope.event-my_cool_feature.bzr

In either case, bzr creates a “Bazaar bundle”, including both the patch and extra revision metadata to ease merging your changes using bzr.

How-to: Push your Bazaar branch to Launchpad

As an alternative to uploading a patch from your Bazaar branch (or e-mailing it), you can also publish your branch to a server where it can be cloned over HTTP for others to use, as well as for review and merging by the package maintainer.

Let’s assume that you have been hacking on zope.event, and want to publish your ‘dictchannel’ feature branch in hopes of landing it in the next release. Let’s also assume that you have an account on Launchpad, and want to publish your branch there.

$ bzr launchpad-login <userid>
$ bzr push lp:~<userid>/zope.event/dictchannel

Replace <userid> with your Launchpad account ID.

How-to: Request a merge

After pushing your branch, you can include its URL in an e-mail you send to the maintainer, requesting a merge of your branch. You can also link your branch to a Launchpad issue, as well as using Launchpad’s “merge request” feature to alert the maintainer(s) that your branch is ready to merge.