changeset 11816:e1359ad582f6

check-code: add exit status so that we can use it in a shell command combination and/or in hg hooks.
author Alecs King <alecsk@gmail.com>
date Thu, 12 Aug 2010 16:42:41 +0800
parents 20a88cf7ee92
children d12fe809e1ee
files contrib/check-code.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Thu Aug 12 09:40:48 2010 +0100
+++ b/contrib/check-code.py	Thu Aug 12 16:42:41 2010 +0800
@@ -7,7 +7,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import re, glob, os
+import re, glob, os, sys
 import optparse
 
 def repquote(m):
@@ -261,5 +261,8 @@
         check = args
 
     for f in check:
-        checkfile(f, maxerr=options.per_file, warnings=options.warnings,
-                  blame=options.blame)
+        ret = 0
+        if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
+                         blame=options.blame):
+            ret = 1
+    sys.exit(ret)