[meld] Simplify creation of diff chunks



commit f6a99b2e5ccb16d003e36f60edaf0380fc072566
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Sep 29 14:37:06 2008 +0200

    Simplify creation of diff chunks
---
 diffutil.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/diffutil.py b/diffutil.py
index 51d8a8e..7e4b487 100644
--- a/diffutil.py
+++ b/diffutil.py
@@ -233,14 +233,13 @@ class Differ(object):
                 l0, h0, l1, h1, l2, h2 = block
                 if h0-l0 == h2-l2 and texts[0][l0:h0] == texts[2][l2:h2]:
                     if l1 != h1:
-                        out0 = ('replace', block[2], block[3], block[0], block[1])
-                        out1 = ('replace', block[2], block[3], block[4], block[5])
+                        tag = "replace"
                     else:
-                        out0 = ('insert', block[2], block[3], block[0], block[1])
-                        out1 = ('insert', block[2], block[3], block[4], block[5])
+                        tag = "insert"
                 else:
-                    out0 = ('conflict', block[2], block[3], block[0], block[1])
-                    out1 = ('conflict', block[2], block[3], block[4], block[5])
+                    tag = "conflict"
+                out0 = (tag, l1, h1, l0, h0)
+                out1 = (tag, l1, h1, l2, h2)
                 yield out0, out1
 
     def set_sequences_iter(self, *sequences):



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