[extensions-web] review: Move == optimization into diffutils
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] review: Move == optimization into diffutils
- Date: Tue, 26 Jun 2012 20:24:24 +0000 (UTC)
commit ffe8979409209d065d91b34eefb0b81b4163ffb2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 26 14:16:13 2012 -0400
review: Move == optimization into diffutils
sweettooth/review/diffutils.py | 14 +++++++++-----
sweettooth/review/views.py | 3 ---
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 831d4f1..90cb7cf 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -728,11 +728,15 @@ def get_chunks(a, b):
return result
- if a is None or b is None:
- if a is not None:
- yield get_fake_chunk(len(a), tag='delete')
- if b is not None:
- yield get_fake_chunk(len(b), tag='insert')
+ if a == b:
+ return
+
+ if a is None:
+ yield get_fake_chunk(len(b), tag='insert')
+ return
+
+ if b is None:
+ yield get_fake_chunk(len(a), tag='delete')
return
a_num_lines = len(a)
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 878a49c..ebae1b1 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -176,9 +176,6 @@ def ajax_get_file_diff_view(request, version):
old_zipfile, new_zipfile = get_zipfiles(get_old_version(version), version)
oldlines, newlines = grab_lines(old_zipfile, filename), grab_lines(new_zipfile, filename)
- if oldlines == newlines:
- return None
-
chunks = list(get_chunks(oldlines, newlines))
return dict(chunks=chunks,
oldlines=oldlines,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]