[extensions-web] review: Remove is_whitespace feature as well
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] review: Remove is_whitespace feature as well
- Date: Tue, 26 Jun 2012 20:23:39 +0000 (UTC)
commit e2cb7f2661b91049a22e917fce32d3b6e84d0cb6
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 26 12:40:35 2012 -0400
review: Remove is_whitespace feature as well
sweettooth/review/diffutils.py | 34 ++--------------------------------
sweettooth/review/views.py | 2 +-
2 files changed, 3 insertions(+), 33 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 8e7e8bf..39d6632 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -698,7 +698,6 @@ class MyersDiffer:
return result
ALPHANUM_RE = re.compile(r'\w')
-WHITESPACE_RE = re.compile(r'\s')
def get_line_changed_regions(oldline, newline):
if oldline is None or newline is None:
@@ -752,12 +751,7 @@ def get_chunks(a, b):
else:
oldregion = newregion = []
- is_whitespace = (oldlinenum, newlinenum) in meta['whitespace_lines']
-
- result = [vlinenum,
- oldlinenum, newlinenum,
- oldregion, newregion,
- is_whitespace]
+ result = [vlinenum, oldlinenum, newlinenum, oldregion, newregion]
if oldlinenum and oldlinenum in meta.get('moved', {}):
destination = meta["moved"][oldlinenum]
@@ -855,31 +849,7 @@ def opcodes_with_metadata(differ):
inserts = []
for tag, i1, i2, j1, j2 in differ.get_opcodes():
- meta = {
- # True if this chunk is only whitespace.
- "whitespace_chunk": False,
-
- # List of tuples (x,y), with whitespace changes.
- "whitespace_lines": [],
- }
-
- if tag == 'replace':
- # replace groups are good for whitespace only changes.
- assert (i2 - i1) == (j2 - j1)
-
- for i, j in zip(xrange(i1, i2), xrange(j1, j2)):
- if (WHITESPACE_RE.sub("", differ.a[i]) ==
- WHITESPACE_RE.sub("", differ.b[j])):
- # Both original lines are equal when removing all
- # whitespace, so include their original line number in
- # the meta dict.
- meta["whitespace_lines"].append((i + 1, j + 1))
-
- # If all lines are considered to have only whitespace change,
- # the whole chunk is considered a whitespace-only chunk.
- if len(meta["whitespace_lines"]) == (i2 - i1):
- meta["whitespace_chunk"] = True
-
+ meta = {}
group = (tag, i1, i2, j1, j2, meta)
groups.append(group)
diff --git a/sweettooth/review/views.py b/sweettooth/review/views.py
index 3dc159e..f2600f0 100644
--- a/sweettooth/review/views.py
+++ b/sweettooth/review/views.py
@@ -124,7 +124,7 @@ def get_fake_chunks(numlines, tag):
# When a file is added/deleted, we want to show a view where
# we have nothing in one pane, and a bunch of inserted/delted
# lines in the other.
- lines = [[n, n, n, [], [], False] for n in range(1, numlines + 1)]
+ lines = [[n, n, n, [], []] for n in range(1, numlines + 1)]
return [{ 'lines': lines,
'numlines': numlines,
'change': tag,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]