[plug] Merging 2 files, CVS-style

Peter Wright pete at cygnus.uwa.edu.au
Thu Apr 13 11:04:36 WST 2000

Hi all,

Yesterday I encountered a problem which I thought should be quite easy
to handle, but turned out to be rather annoying and I couldn't solve
to my satisfaction.

I'm working on a software project using CVS for version control, which
I'm guessing at least a few of you should be familiar with. Now CVS
has a very nice conflict-resolution merging facility - when you've
changed an old revision of a file and then try to update it, it marks
the file as having a "conflict" and alters it to incorporate the
conflicting regions, approximately like so:

<<<<<< filename
int a, b, c;
float a, b, c;
>>>>>> version 1.3

I'm now in a situation where I want to merge and "conflict-resolve"
two files in the way CVS does it, but outside of CVS. I'd hoped that
diff or sdiff or one of the related commands might be able to do it
for me, but it doesn't quite seem to be possible (at least not in the
way that CVS does it). If I wanted to do a simple merge, sdiff would
be okay, but what I want to do involves lots of small changes (the
sort of thing that can be automated to some degree inside
vim|othergoodeditor, but would be slow, painful and less flexible
using the interactive sdiff).

Any helpful suggestions, ideas, or witty comments leading in the
direction of a solution would be much appreciated. :)



A bug in the hand is better than one as yet undetected.

More information about the plug mailing list