From ba8936120e4de7a4cdf6093a0e0cb04e0d1b8a59 Mon Sep 17 00:00:00 2001 From: Clint Smullen Date: Sat, 15 Nov 2008 00:21:31 -0500 Subject: [PATCH] Remove the pointless, repository destroying assertion and just have the script check every line in the file if it cannot get context information. --- util/style.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/util/style.py b/util/style.py index 8b0f48fb9..a117fab70 100644 --- a/util/style.py +++ b/util/style.py @@ -314,14 +314,16 @@ def do_check_whitespace(ui, repo, *files, **args): fctx = wctx.filectx(fname) pctx = fctx.parents() - assert len(pctx) in (1, 2) file_data = fctx.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, len(lines)) - mod_lines = mod_lines & m2 # only the lines that are new in both + if len(pctx) in (1, 2): + mod_lines = modified_lines(pctx[0].data(), file_data, len(lines)) + if len(pctx) == 2: + m2 = modified_lines(pctx[1].data(), file_data, len(lines)) + mod_lines = mod_lines & m2 # only the lines that are new in both + else: + mod_lines = xrange(0, len(lines)) fixonly = set() for i,line in enumerate(lines): -- 2.30.2