[PATCH] check-code: add exit status

Alecs King alecsk at gmail.com
Thu Aug 12 03:45:52 CDT 2010


 contrib/check-code.py |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)


# HG changeset patch
# User Alecs King <alecsk at gmail.com>
# Date 1281602561 -28800
# Branch my
# Node ID f0ab6079f4e04493cc5d2d03bcc810ad5479ede1
# Parent  6a5e159eb93ed120407e533bda4eceb0cf7f0435
check-code: add exit status

so that we can use it in a shell command combination and/or in hg hooks.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -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 @@ if __name__ == "__main__":
         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)



More information about the Mercurial-devel mailing list