[PATCH] check-code: add exit status

Nicolas Dumazet nicdumz at gmail.com
Thu Aug 12 09:49:53 CDT 2010


On Thu, 12 Aug 2010 16:45:52 +0800
Alecs King <alecsk at gmail.com> wrote:

>  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.

good idea, thanks, pushed to crew.

-Nicolas.

> 
> 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)
> 
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Nicolas Dumazet — NicDumZ


More information about the Mercurial-devel mailing list