Patchwork [3,of,3] check-code: concatenate "check-code" on compile time

login
register
mail settings
Submitter Simon Heimberg
Date July 1, 2013, 5:03 a.m.
Message ID <f64027953a579d84be24.1372654993@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1775/
State Accepted
Commit 5aeb03b48ab4b65f797bf8a4a2be5007da4faac1
Delegated to: Kevin Bullock
Headers show

Comments

Simon Heimberg - July 1, 2013, 5:03 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1372654258 -7200
# Node ID f64027953a579d84be24ddbc1599d018ee88417c
# Parent  9f1b62927ce36c53784035b7ca3996240fc81b05
check-code: concatenate "check-code" on compile time

The python compiler concatenates two string constants. Use this instead of
doing it on run time or instruct the user how to do it.
The strings "no-check-code" and "check-code-ignore" has to be specially written
for not skipping some checking of the code of this file.
Augie Fackler - July 9, 2013, 9:57 p.m.
queued, thanks

On Jul 1, 2013, at 1:03 AM, Simon Heimberg <simohe@besonet.ch> wrote:

> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1372654258 -7200
> # Node ID f64027953a579d84be24ddbc1599d018ee88417c
> # Parent  9f1b62927ce36c53784035b7ca3996240fc81b05
> check-code: concatenate "check-code" on compile time
> 
> The python compiler concatenates two string constants. Use this instead of
> doing it on run time or instruct the user how to do it.
> The strings "no-check-code" and "check-code-ignore" has to be specially written
> for not skipping some checking of the code of this file.
> 
> diff -r 9f1b62927ce3 -r f64027953a57 contrib/check-code.py
> --- a/contrib/check-code.py	Mon Jul 01 06:50:58 2013 +0200
> +++ b/contrib/check-code.py	Mon Jul 01 06:50:58 2013 +0200
> @@ -411,9 +411,9 @@
>         fp = open(f)
>         pre = post = fp.read()
>         fp.close()
> -        if "no-" + "check-code" in pre:
> +        if "no-" "check-code" in pre:
>             if debug:
> -                print "Skipping %s for %s it has no- and check-code" % (
> +                print "Skipping %s for %s it has no-" " check-code" % (
>                        name, f)
>             break
>         for p, r in filters:
> @@ -452,9 +452,9 @@
>                     n += 1
>                 l = prelines[n]
> 
> -                if "check-code" + "-ignore" in l:
> +                if "check-code" "-ignore" in l:
>                     if debug:
> -                        print "Skipping %s for %s:%s (check-code -ignore)" % (
> +                        print "Skipping %s for %s:%s (check-code" "-ignore)" % (
>                             name, f, n)
>                     continue
>                 elif ignore and re.search(ignore, l, re.MULTILINE):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r 9f1b62927ce3 -r f64027953a57 contrib/check-code.py
--- a/contrib/check-code.py	Mon Jul 01 06:50:58 2013 +0200
+++ b/contrib/check-code.py	Mon Jul 01 06:50:58 2013 +0200
@@ -411,9 +411,9 @@ 
         fp = open(f)
         pre = post = fp.read()
         fp.close()
-        if "no-" + "check-code" in pre:
+        if "no-" "check-code" in pre:
             if debug:
-                print "Skipping %s for %s it has no- and check-code" % (
+                print "Skipping %s for %s it has no-" " check-code" % (
                        name, f)
             break
         for p, r in filters:
@@ -452,9 +452,9 @@ 
                     n += 1
                 l = prelines[n]
 
-                if "check-code" + "-ignore" in l:
+                if "check-code" "-ignore" in l:
                     if debug:
-                        print "Skipping %s for %s:%s (check-code -ignore)" % (
+                        print "Skipping %s for %s:%s (check-code" "-ignore)" % (
                             name, f, n)
                     continue
                 elif ignore and re.search(ignore, l, re.MULTILINE):