[Top][All Lists]

[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:33:01 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Mark E. Hamilton wrote:
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:

for file in $(cvs -q update | egrep '^C' | cut -f2 -d' ')
 # 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}

Whoops, major typo. In the second sed() command DON'T use the '-i' option with the redirect; you'll end up with an empty file. Sorry.

 sed -e '/^<<<<<<</,/^=======/d' -e '/^>>>>>>>/d' ${file} > blarg \
   && mv blarg ${file}

FWIW, if your sed() supports the '-i' option you don't need to do the redirect and move.

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

reply via email to

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