[extensions-web] review: Remove some silly "interesting line" features from diffutils
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] review: Remove some silly "interesting line" features from diffutils
- Date: Tue, 26 Jun 2012 20:23:34 +0000 (UTC)
commit d870dd9aacb84b057e6bdb1b77100fb32a32fec9
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 26 11:57:16 2012 -0400
review: Remove some silly "interesting line" features from diffutils
sweettooth/review/diffutils.py | 45 ----------------------------------------
1 files changed, 0 insertions(+), 45 deletions(-)
---
diff --git a/sweettooth/review/diffutils.py b/sweettooth/review/diffutils.py
index 8cd2766..8e7e8bf 100644
--- a/sweettooth/review/diffutils.py
+++ b/sweettooth/review/diffutils.py
@@ -39,9 +39,6 @@ class MyersDiffer:
self.a_data = self.b_data = None
self.ignore_space = ignore_space
self.minimal_diff = False
- self.interesting_line_regexes = []
- self.interesting_lines = [{}, {}]
- self.interesting_line_table = {}
# SMS State
self.max_lines = 0
@@ -56,26 +53,6 @@ class MyersDiffer:
return 1.0 * (a_equals + b_equals) / \
(self.a_data.length + self.b_data.length)
- def add_interesting_line_regex(self, name, regex):
- """Registers a regular expression used to look for interesting lines.
-
- All interesting lines found that match the regular expression will
- be stored and tagged with the given name. Callers can use
- get_interesting_lines to get the results.
- """
- self.interesting_line_regexes.append((name, regex))
- self.interesting_lines[0][name] = []
- self.interesting_lines[1][name] = []
-
- def get_interesting_lines(self, name, is_modified_file):
- """Returns the interesting lines tagged with the given name."""
- if is_modified_file:
- index = 1
- else:
- index = 0
-
- return self.interesting_lines[index].get(name, [])
-
def get_opcodes(self):
"""
Generator that returns opcodes representing the contents of the
@@ -197,11 +174,6 @@ class MyersDiffer:
linenum = 0
- if is_modified_file:
- interesting_lines = self.interesting_lines[1]
- else:
- interesting_lines = self.interesting_lines[0]
-
for line in lines:
# TODO: Handle ignoring/triming spaces, ignoring casing, and
# special hooks
@@ -214,31 +186,14 @@ class MyersDiffer:
if len(stripped_line) > 0:
line = stripped_line
- interesting_line_name = None
-
try:
code = self.code_table[line]
- interesting_line_name = \
- self.interesting_line_table.get(code, None)
except KeyError:
# This is a new, unrecorded line, so mark it and store it.
self.last_code += 1
code = self.last_code
self.code_table[line] = code
- # Check to see if this is an interesting line that the caller
- # wants recorded.
- if stripped_line:
- for name, regex in self.interesting_line_regexes:
- if regex.match(raw_line):
- interesting_line_name = name
- self.interesting_line_table[code] = name
- break
-
- if interesting_line_name:
- interesting_lines[interesting_line_name].append((linenum,
- raw_line))
-
codes.append(code)
linenum += 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]