[meld] Fix conflict detection between insert hunks and other hunks



commit 1fed894e698ff5d5260b01a6b39ce5b773708160
Author: Piotr Piastucki <the_leech users berlios de>
Date:   Mon Jul 6 18:05:33 2009 +0200

    Fix conflict detection between insert hunks and other hunks
    
    Currently, a conflict is reported when a replace or delete hunk starts
    at the same position as an insert. This patch leaves these hunks
    separated. The change to FileDiff drawing removes a redundant check on
    change hunks that stops this bugfix from being effective.

 diffutil.py |    7 +++++++
 filediff.py |   10 +---------
 2 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/diffutil.py b/diffutil.py
index 8f9c63b..907ba7f 100644
--- a/diffutil.py
+++ b/diffutil.py
@@ -185,6 +185,11 @@ class Differ(object):
                 high_seq = 0
             else:
                 high_seq = int(seq0[0][LO] > seq1[0][LO])
+                if seq0[0][LO] == seq1[0][LO]:
+                    if seq0[0][0] == "insert":
+                        high_seq = 0
+                    elif seq1[0][0] == "insert":
+                        high_seq = 1
 
             high_diff = seq[high_seq].pop(0)
             high_mark = high_diff[HI]
@@ -197,6 +202,8 @@ class Differ(object):
                 other_diff = seq[other_seq][0]
                 if high_mark < other_diff[LO]:
                     break
+                if high_mark == other_diff[LO] and not (high_diff[0] == other_diff[0] == "insert"):
+                    break
 
                 using[other_seq].append(other_diff)
                 seq[other_seq].pop(0)
diff --git a/filediff.py b/filediff.py
index 0167032..f825525 100644
--- a/filediff.py
+++ b/filediff.py
@@ -696,21 +696,13 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                 context.rectangle(0, ypos0, width, ypos1 - ypos0)
                 context.fill()
 
-        last_change = None
         for change in self.linediffer.single_changes(pane, self._get_texts()):
             change, skip = self._consume_blank_lines(change, pane, change[5])
             if skip:
                 continue
             if change[2] < start_line: continue
             if change[1] > end_line: break
-            if last_change and change[1] <= last_change[2]:
-                last_change = ("conflict", last_change[1], max(last_change[2],change[2]))
-            else:
-                if last_change:
-                    draw_change(last_change)
-                last_change = change
-        if last_change:
-            draw_change(last_change)
+            draw_change(change)
 
         if textview.is_focus():
             context.set_line_width(3)



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