[extensions-web] review: Clean up region getting



commit 73de7416b815958594787cd4e62c67777b99282d
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sat Jul 14 07:56:53 2012 -0400

    review: Clean up region getting

 sweettooth/review/diffutils.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 90cb7cf..c286baa 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -656,6 +656,9 @@ def get_line_changed_regions(oldline, newline):
     if oldline is None or newline is None:
         return (None, None)
 
+    if oldline == newline:
+        return (None, None)
+
     # Use the SequenceMatcher directly. It seems to give us better results
     # for this. We should investigate steps to move to the new differ.
     differ = SequenceMatcher(None, oldline, newline)
@@ -717,10 +720,7 @@ def get_chunks(a, b):
         oldlinenum = oldindex + 1
         newlinenum = newindex + 1
 
-        if oldline and newline and oldline != newline:
-            oldregion, newregion = get_line_changed_regions(oldline, newline)
-        else:
-            oldregion = newregion = []
+        oldregion, newregion = get_line_changed_regions(oldline, newline)
 
         result = dict(oldlinenum=oldlinenum, newlinenum=newlinenum,
                       oldindex=oldindex, newindex=newindex,



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