codem - blog

Posts Tagged ‘version control’

providing patches in feature-based web development

A while back, I did a presentation to the Sydney PHP Group on feature based web development using Bazaar, a distributed version control system. At the time is was quite interesting to see the number of attendees who a) didn’t know about or use version control or b) were using CVS (the instant coffee of version control).

If you are doing web development amongst a team and want a really solid branching system without headache inducing conflict/merge issues then Bazaar is a really valuable tool. One of the best things about patching in Bazaar is the send command:

$ bzr help send
Purpose: Mail or create a merge-directive for submitting changes.
Usage:   bzr send [SUBMIT_BRANCH] [PUBLIC_BRANCH]

The send command enables you by default to mail a patch file to the patch manager, who can then test and merge it into a centralised mainline branch. If you don’t want to mail patches they can be uploaded to the remote server in one go, even though send doesn’t as yet support saving to remote locations.
The trick is to provide ‘-’ (stdout) as the output file then pipe it to ssh for upload to your remote directives location.

bzr send -o - sftp://me@someserver/path/to/remote/branch | ssh me@someserver "cat > /path/to/directives/my.patch"

After bzr does it’s stuff and you’ve logged in to the remote server, a patch file is available (my.patch) that can be applied, tested and either reverted or committed using bzr merge, pull, commit and revert.

Tip 1: if you don’t have SSH access to your server try the bzr upload plugin
Tip 2: storing your public ssh key on the remote server will allow you to perform the send without password prompts.