help-gnu-utils
[Top][All Lists]
Advanced

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

How to get diff3 to only mark conflicting regions?


From: Srinath Avadhanula
Subject: How to get diff3 to only mark conflicting regions?
Date: Thu, 3 Jun 2010 17:19:42 -0700 (PDT)

Hi,

I am trying to get diff3 to work as follows:

   diff3 mine.txt ancestor.txt yours.txt

For every region where ((mine != ancestor) || (yours != ancestor)), i.e., a
conflict region:

1. If (mine == ancestor), then choose yours
2. If (yours == ancestor), then choose mine
3. If (mine == yours), just choose mine (or yours since it doesn't matter)
4. If (mine != yours), then mark it as a conflict.

Looks like I cannot get #3 above to work. I tried out both -x and -3 but
they do not seem to work... Consider the following 2 cases:

Case 1
======

mine.txt  |  ancestor.txt  |  yours.txt
----------+----------------+-----------
line 1    |     line 1     |   line 1
line 2    |     line 2     |   line 2
line 3 X  |     line 3     |   line 3 X
line 4 X  |     line 4     |   line 4 X
line 5    |     line 5     |   line 5
line 6    |     line 6     |   line 6
line 7    |     line 7     |   line 7  
      
In this case, both mine and yours have made the same change to
ancestor.txt. In this case, I want there to be no conflicts marked.
However, "diff3 --merge" still detects lines 3 and 4 as conflicts and
produces something like:

line 1
line 2    
<<<< ancestor.txt
line 3
line 4    
=====
line 3 X
line 4 X
>>>> b.txt
line 5    
line 6    
line 7

If I give "-x" or "-3", then I do not get any conflicts (as expected), but
the following case breaks.

Case 2
======

mine.txt  |  ancestor.txt  |  yours.txt
----------+----------------+-----------
line 1 A  |     line 1     |   line 1
line 2    |     line 2     |   line 2
line 3    |     line 3     |   line 3 B
line 4    |     line 4     |   line 4
line 5    |     line 5     |   line 5
line 6    |     line 6     |   line 6
line 7 A  |     line 7     |   line 7 B
      
In this case, I expect that the output merge file is:

line 1 A  
line 2    
line 3 B
line 4    
line 5    
line 6    
<<<<< mine.txt
line 7 A  
||||| ancestor.txt
line 7
=====
line 7 B
>>>>> yours.txt

In this case, "diff3 --merge" works but If I give either "-x" or "-3", then
the final line is NOT marked as a conflict and diff3 happily accepts either
mine.txt or yours.txt.

I greatly appreciate your time if you managed to get this far :)

Regards,
Srinath


-- 
View this message in context: 
http://old.nabble.com/How-to-get-diff3-to-only-mark-conflicting-regions--tp28774368p28774368.html
Sent from the Gnu - Utils - Help mailing list archive at Nabble.com.




reply via email to

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