[PATCH 4 of 4] check-code: allow an escape patter to be specified for testpattern

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Aug 8 17:27:58 CDT 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1407024293 25200
#      Sat Aug 02 17:04:53 2014 -0700
# Node ID 274a15f65ecbb3718c4fbd35da6b819ba7ce59f2
# Parent  8fc5b99e6d48a053331c6f28cdd43aa255211255
check-code: allow an escape patter to be specified for testpattern

Before this patch it was impossible to introduce a #no-xxx comment to disable a
test pattern warning.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -177,16 +177,18 @@ utestpats = [
      "glob match with no glob character (?*/)"),
   ]
 ]
 
 for i in [0, 1]:
-    for p, m in testpats[i]:
+    for tp in testpats[i]:
+        p = tp[0]
+        m = tp[1]
         if p.startswith(r'^'):
             p = r"^  [$>] (%s)" % p[1:]
         else:
             p = r"^  [$>] .*(%s)" % p
-        utestpats[i].append((p, m))
+        utestpats[i].append((p, m) + tp[2:])
 
 utestfilters = [
     (r"<<(\S+)((.|\n)*?\n  > \1)", rephere),
     (r"( *)(#([^\n]*\S)?)", repcomment),
 ]


More information about the Mercurial-devel mailing list