Bazaar

Bazaar

 




Wiki Tools

  • Login
  • Create Profile
  • FindPage
  • RecentChanges
  • Page History
  • Attachments

Giving Back

One of the fun things about working on a version control system like Bazaar is that the userbase has a high level of proficiency in contributing back into the tool. So, how does one contribute code back into Bazaar?

Making the change

We currently suggest that code be developed against the current development version of Bazaar.

First, get a local copy of the development mainline [1]

$ mkdir ~/bzr
$ cd ~/bzr
$ bzr init-repo .
$ bzr branch http://bazaar-vcs.org/bzr/bzr.dev/ bzr.dev

You may wish to consider using this copy of Bazaar. See Installation for details.

Now make your own branch:

$ bzr branch ~/bzr/bzr.dev ~/bzr/giveback

This will give you a tree called "giveback" that you can work on and commit in. Here, you can study the code, make a fix or a new feature. Feel free to commit early and often (after all, it's your branch!).

Please see the HACKING document in the bzr source tree for hints and style suggestions.

When you are done, make sure that you commit your last set of changes as well! Once you are happy with your changes, ask for them to be merged, as described below.

Generating a bundle

To generate a bundle, type

$ cd ~/bzr/giveback
$ bzr send -o ~/mychange.patch

Bazaar bundles can usually be applied by patch, so '.patch' is a good extension to use. '.bundle' is not, because most mail clients will send it as a binary file. We can directly merge your code from a bundle. But if the bundle is too long, you can generate a patch instead.

Generating a patch and uploading your branch

If the bundle is too long, you can generate a patch instead. A patch will be shorter, because it excludes the extra info that is needed to merge it. We can use a patch, but we'd prefer to merge from your branch, and that will make life easier for you, too. So if you generate a patch, it's nice to provide a public copy of the branch, also.

# Create a patch showing the changes you made to the mainline.
$ cd ~/bzr/giveback
$ bzr diff -r ancestor:../bzr.dev > ~/mychange.patch
# Upload a branch
$ bzr push sftp://example.com/home/jrandom/public_html/giveback

Requesting a merge

To request a merge, send an email to bazaar@lists.canonical.com

  • Please start your subject line with [MERGE]
  • Clearly describe the problem or feature that your change addresses
  • If it fixes a bug listed in the bugtracker, include the bug number or url
  • Attach your bundle or patch
  • Optionally, include a link to the public branch location

The change will be reviewed by the core developers. They may request changes or further explanation before merging. If the process seems stalled, please remind us. We do not deliberately ignore submissions, but we do sometimes make mistakes.

If two core developers approve the change, (by saying '+1' in their email), it will be merged.

Q & A

Why make a local copy of bzr.dev?

Making a local mirror of bzr.dev is not strictly necessary, but it means

  • You can use that copy of bzr.dev as your main bzr executable, and keep up-to-date with bzr pull.
  • Certain operations are faster, and can be done when offline. For example:
    • bzr bundle
    • bzr diff -r ancestor:...
    • bzr merge
  • When it's time to create your next branch, it's more convenient.

Rsync versus bzr branch

[1]

It is also possible to pull a copy of bzr.dev using rsync. This is quite a bit faster than older versions of bzr (<=0.8), but bzr has been improved in recent versions (see Performance/0.9).

To do so, use: 'rsync -av bazaar-vcs.org::bazaar-ng/bzr/bzr.dev/ bzr.dev'

This will not make use of a local repository, so it may be best to download to a staging area, and then branch that into the working directory.