check-code: add exit status
authorAlecs King <alecsk@gmail.com>
Thu, 12 Aug 2010 16:42:41 +0800
changeset 11816 e1359ad582f6
parent 11815 20a88cf7ee92
child 11817 d12fe809e1ee
check-code: add exit status so that we can use it in a shell command combination and/or in hg hooks.
contrib/check-code.py
--- 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)