Mercurial > public > mercurial-scm > hg-stable
comparison contrib/check-code.py @ 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 | 16723af520b0 |
children | 73112cb2a6d7 |
comparison
equal
deleted
inserted
replaced
11815:20a88cf7ee92 | 11816:e1359ad582f6 |
---|---|
5 # Copyright 2010 Matt Mackall <mpm@selenic.com> | 5 # Copyright 2010 Matt Mackall <mpm@selenic.com> |
6 # | 6 # |
7 # This software may be used and distributed according to the terms of the | 7 # This software may be used and distributed according to the terms of the |
8 # GNU General Public License version 2 or any later version. | 8 # GNU General Public License version 2 or any later version. |
9 | 9 |
10 import re, glob, os | 10 import re, glob, os, sys |
11 import optparse | 11 import optparse |
12 | 12 |
13 def repquote(m): | 13 def repquote(m): |
14 t = re.sub(r"\w", "x", m.group('text')) | 14 t = re.sub(r"\w", "x", m.group('text')) |
15 t = re.sub(r"[^\sx]", "o", t) | 15 t = re.sub(r"[^\sx]", "o", t) |
259 check = glob.glob("*") | 259 check = glob.glob("*") |
260 else: | 260 else: |
261 check = args | 261 check = args |
262 | 262 |
263 for f in check: | 263 for f in check: |
264 checkfile(f, maxerr=options.per_file, warnings=options.warnings, | 264 ret = 0 |
265 blame=options.blame) | 265 if not checkfile(f, maxerr=options.per_file, warnings=options.warnings, |
266 blame=options.blame): | |
267 ret = 1 | |
268 sys.exit(ret) |