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: Mark E. Hamilton
Subject: Re: Can I turn off merge conflict markers?
Date: Thu, 10 Feb 2005 10:08:20 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Todd Denniston wrote:
"Mark E. Hamilton" wrote:

address@hidden wrote:
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

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.


A fourth approach would be to do the 'cvs update' to merge everything that can be merged successfully, and then use something like this to automatically select one of the two choices in the conflict lines:

#!/bin/bash
for file in $(cvs -q update | egrep '^C' | cut -f2 -d' ')
do
 # Pick one of these two sed commands.

# This will discard the repository changes and keep the project changes
 sed -e '/^=======/,/^>>>>>>>/d' -e '/^<<<<<<</d' ${file} > blarg \
   && mv blarg ${file}

# This will discard the project changes and keep the respository changes
 sed -i -e '/^<<<<<<</,/^=======/d' -e '/^>>>>>>>/d' ${file} > blarg \
   && mv blarg ${file}
done



--
----------------
Mark E. Hamilton
Orion International Technologies, Inc.
Sandia National Laboratory, NM.
844-7666





reply via email to

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