A while ago, KDE branched the 4.0.x releases into their own subversion branch directory. This reminded me that I’ve been using a little script for a while which comes in quite handy when you want to commit a patch to multiple branches.
The script is called ‘ilc’ (which originally stood for ‘integrate last change’ but it actually integrates any revision you specify). It’s a little Bash script which expects you to have separate checkouts for the different branches (so it doesn’t integrate the change “in place”).
For instance, in my directory layout, there’s the KDE trunk checkout in ~/src/kde/trunk and the KDE 4.0.x branch checkout in ~/src/kde/40. I usually work in the trunk branch, but every now and then I want to backport something (usually a bugfix) to the 4.0.x branch. So after hacking away, I eventually do this:
frerich@helios:~/src/kde/trunk/kdenetwork/knewsticker$ svn ci
Transmitting file data .
Committed revision 765024.
So SVN gave me the number of the revision I just committed. Using the ilc script, all I need to do to integrate this change into the 4.0.x branch is
frerich@helios:~/src/kde/trunk/kdenetwork/knewsticker$ ilc 765024 ~/src/kde/40
The script will make sure that the affected files in the 4.0.x checkout are up to date, then apply the patch, and finally it’ll let me inspect the patch it did, abort the merge, or commit. When committing, it’ll use the original log message plus a prefix like “automatically merged revision 765024:” so that I can lateron still see that this commit was actually a backport of something else.