style: prevent the style hook from aborting uncleanly because of an exception
authorNathan Binkert <nate@binkert.org>
Mon, 10 Jan 2011 19:11:16 +0000 (11:11 -0800)
committerNathan Binkert <nate@binkert.org>
Mon, 10 Jan 2011 19:11:16 +0000 (11:11 -0800)
util/style.py

index a039cb432f151d5e2d0bbcdf46749b84417a1f91..1018e813cd0981b1068c2751c80daae682cb42a0 100644 (file)
@@ -341,12 +341,24 @@ def check_hook(hooktype):
 def check_style(ui, repo, hooktype, **kwargs):
     check_hook(hooktype)
     args = {}
-    return do_check_style(ui, repo, **args)
+
+    try:
+        return do_check_style(ui, repo, **args)
+    except Exception, e:
+        import traceback
+        traceback.print_exc()
+        return True
 
 def check_format(ui, repo, hooktype, **kwargs):
     check_hook(hooktype)
     args = {}
-    return do_check_format(ui, repo, **args)
+
+    try:
+        return do_check_format(ui, repo, **args)
+    except Exception, e:
+        import traceback
+        traceback.print_exc()
+        return True
 
 try:
     from mercurial.i18n import _