ARM: Clean up use of TBit and JBit.
[gem5.git] / util / style.py
index a117fab70bbd187347060c5f839af09b8b8147d9..606d5984b2da6dca0b7fac0168f27ad528c27978 100644 (file)
@@ -72,7 +72,7 @@ def format_file(filename):
     if file_type(filename) in format_types:
         return True
 
-    return False
+    return True 
 
 def checkwhite_line(line):
     match = lead.search(line)
@@ -275,15 +275,15 @@ def do_check_whitespace(ui, repo, *files, **args):
         if args.get('auto', False):
             result = 'f'
         else:
-            result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", "^[aif]$", "a")
+            while True:
+                result = ui.prompt("(a)bort, (i)gnore, or (f)ix?", default='a')
+                if result in 'aif':
+                    break
+
         if result == 'a':
             return True
-        elif result == 'i':
-            pass
         elif result == 'f':
             fixwhite(repo.wjoin(name), args['tabsize'], fixonly)
-        else:
-            raise util.Abort(_("Invalid response: '%s'") % result)
 
         return False
 
@@ -304,7 +304,12 @@ def do_check_whitespace(ui, repo, *files, **args):
             if prompt(fname):
                 return True
 
-    wctx = repo.workingctx()
+    try:
+        wctx = repo.workingctx()
+    except:
+        from mercurial import context
+        wctx = context.workingctx(repo)
+
     for fname in modified:
         if skip(fname):
             continue
@@ -321,7 +326,8 @@ def do_check_whitespace(ui, repo, *files, **args):
             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
+                # only the lines that are new in both
+                mod_lines = mod_lines & m2
         else:
             mod_lines = xrange(0, len(lines))
 
@@ -342,15 +348,15 @@ def do_check_whitespace(ui, repo, *files, **args):
             if prompt(fname, fixonly):
                 return True
 
-def check_whitespace(ui, repo, hooktype, node, parent1, parent2):
+def check_whitespace(ui, repo, hooktype, node, parent1, parent2, **kwargs):
     if hooktype != 'pretxncommit':
         raise AttributeError, \
               "This hook is only meant for pretxncommit, not %s" % hooktype
 
     args = { 'tabsize' : 8 }
-    do_check_whitespace(ui, repo, **args)
+    return do_check_whitespace(ui, repo, **args)
 
-def check_format(ui, repo, hooktype, node, parent1, parent2):
+def check_format(ui, repo, hooktype, node, parent1, parent2, **kwargs):
     if hooktype != 'pretxncommit':
         raise AttributeError, \
               "This hook is only meant for pretxncommit, not %s" % hooktype