From 76b447b70b481c3dc5ea1d7b4cf1909d6dbe2b2c Mon Sep 17 00:00:00 2001
From: Kai Willadsen <kai.willadsen@gmail.com>
Date: Mon, 29 Sep 2008 14:37:06 +0200
Subject: [PATCH] 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):
-- 
1.6.0.6

