Commiting Patches with CVS

Motivation

Have you ever wanted to commit only some of the changes that you've made to few files, but not, for example, the debug code that you added to get it to work? Still, you'd like to keep that debug code in your working directory, you just don't want to check it in.

Do you like to check in only independent and related changes in each commit even though you may be working on more than one thing at once?

Have you wanted to makes a quick change to a file before checking it in, but still have the old version in your working directory?

If so, then cvs-commit-patch and its emacs interface cvs-commit-patch-buffer can help make this process as simple and easy as editing a diff buffer in emacs.

This code has been working reliably for me for over two years.

The program: cvs-commit-patch

cvs-commit-patch is an independent shell script that commits a patch (as generated by diff(1)) to a cvs repository. It It requires bash(1) and a few utilities from the patchutils distribution.

The emacs Interface: cvs-commit-patch-buffer.el

cvs-commit-patch-buffer.el is an emacs interface to cvs-commit-patch. It allows you to just hit C-c C-c in any patch buffer to apply and commit only the changes indicated by the patch, regardless of the changes in your working directory.

One method of working with cvs-commit-patch-buffer is to just M-x vc-diff a file then kill, split or edit the resulting hunks and to then hit C-c C-c to commit the patch. The other is to use PCL cvs mode to tag many files and then to diff them into a buffer which can again be edited and committed.