In my earlier post on using Bazaar for Drupal core development, I explained how to use the Four Kitchens Bazaar repository to streamline development of core patches. For patches you’re developing on your own, those instructions work great. For patches involving a team of developers, you’d want to have a shared mainline branch, which is beyond my last post’s scope and this one’s.
But, what about when two to three people are collaborating, you’re using Bazaar, and someone else has posted an updated patch that you’d like to work from?
First, you’ll want to install BzrTools. If you installed pre-packaged Bazaar for Mac OS X, you already have these plugins installed.
These instructions also assume you’re working on a patch for Drupal 7. If not, replace the number “7” below with the appropriate version.
Warning: Continuing will erase your local changes and replace them with the changes in the patch you apply.
- Copy the patch URL to your clipboard. Don’t bother downloading; Bazaar’s patch utility will download the patch itself.
- Change directories to be somewhere in your development branch for the issue you’re working on.
- Run as one command: bzr pull --overwrite --revision=date:[date-of-patch] bzr://vcs.fourkitchens.com/drupal/7
The --revision part is optional, but specifying a date will help Bazaar apply the patch against the revision the patch was created against (or something very close), which is more likely to work than applying the patch to CVS HEAD directly. Use a date specifier like “yesterday”, “2008-12-30”, or “2008-12-30,13:41:14”. See Bazaar’s complete documentation on revision specifiers.
- bzr patch [url-of-patch]
- bzr commit -m "Applied patch [url-of-patch]."
- bzr merge bzr://vcs.fourkitchens.com/drupal/7
- Resolve conflicts, if any.
- bzr commit -m "Merged in changes to CVS HEAD since patch."
You’ll have a refreshed working copy with the patch applied against the latest Drupal 7. You can now go back to using the instructions on my earlier post to continue working or roll a fresh patch.