info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I turn off merge conflict markers?


From: Todd Denniston
Subject: Re: Can I turn off merge conflict markers?
Date: Thu, 10 Feb 2005 10:11:55 -0500

"Mark E. Hamilton" wrote:
> 
> address@hidden wrote:
> > Can I set a cvs update option so that it will only
> > report merge conflict files and NOT modify them with
> > conflict markers? It does not appear that "cvs update"
> > has an option like this, but maybe there is some trick
> > someone can clue me in on.
> 
> Probably not, but the CVS gurus here would know.
> 
> > When you get a file where automatic merge fails
> > CVS will report a merge conflict and then modify
> > the offending file with conflict markers:
> >     <<<<<<<<
> >     ========
> >     >>>>>>>>
> > ...which is fine most of the time, but now I have a situation
> > where I'm working in a project with someone else's code
> > and I'm getting a lot of these. The difference for these files
> > are trivial. It's a lot of extra hassle to have to
> > go delete all these conflict markers. It's sufficient for me to
> > know there is a problem.  I want to update what I can, but
> > I don't want cvs to touch the conflicted files.
> > I just want it to report them.
> 
> As I see it you've really only got three choices:
> 
> 1. cvs update -C foo.c
> 
> This will replace the file with a fresh version from the repository,
> discarding all the changes made in the sandbox version of the file,
> including those that merged successfully (ie, didn't cause a conflict.)
> Sometimes this is the right thing to do; you'll have to decide.
> 
> 2. cp .#foo.c.x.y
> 
> This will replace the updated version of the file with the version prior
> to the update, discarding all the changes made in the repository version
> of the file, including those that merged successfully (ie, didn't cause
> a conflict.) This is almost never the right thing to do.
> 
> 3. Deal with those pesky conflicts and edit them as necessary.
> 
> This is the right thing to do. This is the only answer that will retain
> any changes that were successfully merged. The caveat of course is that
> you need to run your tests after the update, because even changes that
> successfully merged might still be logically incorrect with the changes
> made in the sandbox.
> 
I believe Mark's responses are correct, but you might be able to use some
other commands to deal with it the way you want.

1. make separate lists of files with and without conflicts (look for C in
the output of update).
 cvs -n update 2>&1 | \
 process_to_separate_filenames_with_conflicts 

2. just update those without conflicts.
   for i in `cat files_without_conflicts`; \
   do cvs update $i;done

3. do something special for the ones with conflicts.
   for i in `cat files_with_conflicts`; \
   do marks_method_1or2 $i;done

marks_method_3 is the only known correct method, but your situation might be
special.

-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane) 
Harnessing the Power of Technology for the Warfighter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]