If you manage an opensource project, chances are high that external contributors will submit patches to you.
Patches are sometimes quite easy to handle. For example a trivial bugfix, a documentation update or any other small size patch is fast to review. First you read the patch hunks to figure out what it does, and if you like it you try to apply it. If it applies you can test it, and if you still like it, it gets commited to your favorite revision control systems (SVN, Mercurial, Git, …whatever).
There are however some cases where this process is simply too fast. The patch may change significant portions of the source code. It may imply further testing. You may need time to make your mind on whether it should be commited or not. And more simply: once applied you may want to polish / rework it.
For all of those non-extensive cases, you need to put the patch “on hold” for a while, then eventually commit it. Here’s how I have come up to deal with them recently for the IzPack Java installer project.
IzPack uses Subversion as its revision control system, and the almighty Atlassian JIRA issue tracker, kindly hosted at the Codehaus.
When you think about patches in pending state, branching in a revision control system sounds quite appropriate. Sadly, everyone knows (or everyone should know) that Subversion is really bad on branching. Of course it branches fast, but merges are absolutely awful in Subversion, although I hear it has improved a bit recently. Also, you need to make your branches public, which is not always what you want.
By contrast Git makes it easy to branch and merge like crazy once you’ve figured out how Git works and you’ve shooted yourself in the foot once or twice
Luckily, it has some support for interacting with Subversion repositories, which means that you can work in Git then push changes back to Subversion once you want it.
So here is how it goes for those cases: I create a branch for each pending patch. The naming convention that I use is damn impressive: pending/JIRA-ID. Say that I need to work on IZPACK-163: I create a branch called pending/IZPACK-163.

Next I can git apply patch-file and commit the patch, and later continue with more commits along as I test / rework the patch. Once I am done, I can simply merge it back to my Git master branch, and do a squashed commit to a local branch that mirrors the Subversion trunk/branch that I am targeting.
As far as I am concerned, I have found this workflow to be very efficient and agile. In a nutshell: one patch (identified by its issue id) equals one branch. Can’t be any simpler I think
Oh and I forgot: with Git I can easily and quickly jump from one branch to another. I can also easily put back some new changes from Subversion into the pending patches branches, as Git remembers merges just right.
What do you think about it? Have you used similar / alternative techniques?
