Making quilt and subversion work together

Submitted by hrm on 19 June, 2008 - 12:52

At work, I've recently taken up managing the codebase of GridSAM. Part of this involved arranging and moving a whole load of patches from one svn repository (maintained internally) to another (the SourceForge site). Subversion on its own isn't all that good at this, so I started using quilt to manage the patches. The workflow goes something like this:

  • Write a script to extract all the patches in the svn log since a given point, including the commit messages.
  • Check out a copy of the svn tree I'm going to apply them to.
  • Import all the patches into quilt in suitable order.
  • Ensure that all the patches apply cleanly, and that the patch comments are appropriate.
  • Feed the patch set to the developers list for review.
  • Check in those patches, one by one, adding the patch comment as the commit message.

Now, this is all well and good, except that in that last step, you have to fiddle with the internals of quilt so that the patch is no longer in the quilt stack. Ideally, I want to shift the bottom patch off the quilt stack after you've applied it into the subversion repository. Even better, I'd like to be able to do all of the above work with a single command.

I've therefore written a quilt svn command that does just that. Download it, put it in /usr/share/quilt/ (or wherever your quilt install is), and then:

$ quilt svn

will apply the current quilt patch to the subversion repository, commit it using the patch comments from quilt as the commit message, and remove the patch from the quilt patch series. You can do this at any point in the quilt series, but it will probably break things if you try it when you're not at the first patch in the series. (This behaviour should probably be changed).

If you want to apply several patches, you can give either the number of patches to apply:

$ quilt svn 3

or the name of the last patch in the sequence to apply:

$ quilt svn last-patch-of-the-block