[PATCH 2 of 8 RFC] tests: add "excluding pattern" field to code check list
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Jun 15 09:45:13 CDT 2012
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1339768793 -32400
# Node ID 02d1b3da58fbff7d2bb8d1e21d3cc352bdad211e
# Parent a14b63be9a04e7fac445fea69bbaf840ca3f4063
tests: add "excluding pattern" field to code check list
this allows code check to skip pattern matching against obviously
ignorable files.
diff -r a14b63be9a04 -r 02d1b3da58fb contrib/check-code.py
--- a/contrib/check-code.py Fri Jun 15 22:59:53 2012 +0900
+++ b/contrib/check-code.py Fri Jun 15 22:59:53 2012 +0900
@@ -266,14 +266,14 @@
]
checks = [
- ('python', r'.*\.(py|cgi)$', pyfilters, pypats),
- ('test script', r'(.*/)?test-[^.~]*$', testfilters, testpats),
- ('c', r'.*\.c$', cfilters, cpats),
- ('unified test', r'.*\.t$', utestfilters, utestpats),
- ('layering violation repo in revlog', r'mercurial/revlog\.py', pyfilters,
- inrevlogpats),
- ('layering violation ui in util', r'mercurial/util\.py', pyfilters,
- inutilpats),
+ ('python', r'.*\.(py|cgi)$', None, pyfilters, pypats),
+ ('test script', r'(.*/)?test-[^.~]*$', None, testfilters, testpats),
+ ('c', r'.*\.c$', None, cfilters, cpats),
+ ('unified test', r'.*\.t$', None, utestfilters, utestpats),
+ ('layering violation repo in revlog', r'mercurial/revlog\.py', None,
+ pyfilters, inrevlogpats),
+ ('layering violation ui in util', r'mercurial/util\.py', None,
+ pyfilters, inutilpats),
]
class norepeatlogger(object):
@@ -325,14 +325,19 @@
"""
blamecache = None
result = True
- for name, match, filters, pats in checks:
+ for name, included, excluded, filters, pats in checks:
if debug:
print name, f
fc = 0
- if not re.match(match, f):
+ if not re.match(included, f):
if debug:
print "Skipping %s for %s it doesn't match %s" % (
- name, match, f)
+ name, included, f)
+ continue
+ if excluded and re.match(excluded, f):
+ if debug:
+ print "Skipping %s for %s it matches %s" % (
+ name, excluded, f)
continue
fp = open(f)
pre = post = fp.read()
More information about the Mercurial-devel
mailing list