[extensions-web] diffutils: Fix added/deleted chunks



commit 805d3dd4468424b75909de16b7cd1a27901fbd14
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Aug 19 16:32:02 2012 -0400

    diffutils: Fix added/deleted chunks

 sweettooth/review/diffutils.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 39cac96..08635b5 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -4,6 +4,7 @@
 # Copyright 2011 Review Board Team
 
 import re
+from itertools import izip_longest
 from difflib import SequenceMatcher
 
 class MyersDiffer:
@@ -759,8 +760,8 @@ def get_chunks(a, b):
     for tag, i1, i2, j1, j2 in differ.get_opcodes():
         numlines = max(i2-i1, j2-j1)
 
-        oldlines = zip(xrange(i1, i2), a[i1:i2])
-        newlines = zip(xrange(j1, j2), b[j1:j2])
+        oldlines = izip_longest(xrange(i1, i2), a[i1:j2])
+        newlines = izip_longest(xrange(j1, j2), b[j1:j2])
 
         lines = [diff_line(old, new) for old, new in zip(oldlines, newlines)]
 



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