I have a patch against vim which applies to packaged version. I would like to automate this, so that when new ubuntu is released, the newer unpatched vim gets patched & built using a recipe. I read documentation on recipes, though I am not sure how to apply a patch.
Should I create branch with modified source and have the recipe merge it? How does that handle when patched branch gets out-of-date with the distro package in newer release? (The patch will very likely still apply; but will the branches be able to merge as well?)
Yes, you should indeed create a new branch derived from the vim Bazaar branch on Launchpad (lp:ubuntu/vim), and commit your patch to that branch.
As long as there are no conflicts when merging, the recipe will merge the two branches when one of them changes, and rebuild. This means that if there is a new revision in the ubuntu branch, it will happily rebuild.
The recipe would look something like this:
The guide for this is here