Remove the pointless, repository destroying assertion and just have the script check...
authorClint Smullen <cws3k@cs.virginia.edu>
Sat, 15 Nov 2008 05:21:31 +0000 (00:21 -0500)
committerClint Smullen <cws3k@cs.virginia.edu>
Sat, 15 Nov 2008 05:21:31 +0000 (00:21 -0500)
util/style.py

index 8b0f48fb9baefa2b3177bcf408255a826e54d6b6..a117fab70bbd187347060c5f839af09b8b8147d9 100644 (file)
@@ -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):