Merging in CVS

John Dennis jdennis at redhat.com
Tue Jun 7 19:02:42 UTC 2005


On Tue, 2005-06-07 at 20:41 +0200, Ralf Ertzinger wrote:
> How do I merge changes from one tree to the other? Say, I have two
> tags A and B in the devel tree, and would like to merge this
> into the FC-4 tree.

Good question, but to the best of my understanding there isn't a good
answer. The problem is each distribution tree (e.g. FC-3, FC-4) are
actually separate CVS files, thus they have no common ancestors and CVS
does not know how to merge them because CVS believes them to be
independent files.

However since I frequently find myself saddled with this task I wrote a
python script that examines a src and dst development tree and builds
makefile (or a shell script) that will bring the dst tree in alignment
with the src tree. I like having it produce a makefile with each stage
as a target so I can review what it will do. For example stage 1 makes
sure any file that is going to be modified is writable, stage 2 copies
new files into the destination and performs a CVS add, stage 3 removes
obsolete files and performs a CVS remove, stage 4 applies a patch file
to bring the common files into alignment (I always review the patch
first, you can also use any interactive diff merge tool of your
choosing). The tool is also smart enough to know about the special files
(e.g. sources, .cvsignore) and the spec file is excluded from the diff
because it almost always requires manual merging.

My usual working stragey is to run the script, review the makefile it
produced and the patch file, and then on the command line if I'm
satisifed its going to to do the right thing I'll say "make stage1",
them make stage2" etc. Finally I conclude with an interactive emacs
ediff session on the spec files and manually insert selected changes
from the src spec file into the dst spec file. Do a local test build,
Vola! I'm done.

Like most homegrown tools its not clean enough for public consumption
but if there is interest I'll clean it up and post it.

This is the only way I've figured out how to do this :-(
-- 
John Dennis <jdennis at redhat.com>




More information about the fedora-extras-list mailing list