summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2007-07-28 21:56:43 -0700
committerNathan Binkert <nate@binkert.org>2007-07-28 21:56:43 -0700
commit41a1acd1e957d6856d5d5c0ddad3d39aa700c01d (patch)
treefe20101318c7a0f391c92d6fc554d9a181c26138 /util
parent1bc36f0787ae7aba2ba78dd9c8b6b6c7d9cbddbf (diff)
downloadgem5-41a1acd1e957d6856d5d5c0ddad3d39aa700c01d.tar.xz
Work around a mercurial bug in bdiff.blocks
--HG-- extra : convert_revision : 597503431883a24f68744bf0dce77356a32d7ff7
Diffstat (limited to 'util')
-rw-r--r--util/style.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/util/style.py b/util/style.py
index 897617779..7238b9801 100644
--- a/util/style.py
+++ b/util/style.py
@@ -244,7 +244,7 @@ def validate(filename, stats, verbose, exit_code):
msg(i, line, 'improper spacing after %s' % match.group(1))
bad()
-def modified_lines(old_data, new_data):
+def modified_lines(old_data, new_data, max_lines):
from itertools import count
from mercurial import bdiff, mdiff
@@ -256,6 +256,8 @@ def modified_lines(old_data, new_data):
modified.add(i)
elif i + 1 >= fend:
break
+ elif i > max_lines:
+ break
return modified
def check_whitespace(ui, repo, hooktype, node, parent1, parent2):
@@ -301,13 +303,14 @@ def check_whitespace(ui, repo, hooktype, node, parent1, parent2):
assert len(pctx) in (1, 2)
file_data = fctx.data()
- mod_lines = modified_lines(pctx[0].data(), file_data)
+ lines = mdiff.splitnewlines(file_data)
+ mod_lines = modified_lines(pctx[0].data(), file_data, len(lines))
if len(pctx) == 2:
m2 = modified_lines(pctx[1].data(), file_data)
mod_lines = mod_lines & m2 # only the lines that are new in both
fixonly = set()
- for i,line in enumerate(mdiff.splitnewlines(file_data)):
+ for i,line in enumerate(lines):
if i not in mod_lines:
continue