[PATCH 1 of 4] check-code: rewrite py3 exclusion pattern with negative lookahead

Yuya Nishihara yuya at tcha.org
Wed May 3 01:50:21 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1493626222 -32400
#      Mon May 01 17:10:22 2017 +0900
# Node ID 92e0bf3b4a6615fb8f119b487cb4bbc324228050
# Parent  9b1232b9e87d69465744d8b50a7c84fc2e60347a
check-code: rewrite py3 exclusion pattern with negative lookahead

I want to add more patterns, but negative lookbehind requires patterns of
the same length so not useful.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -492,7 +492,7 @@ py3pats = [
 checks = [
     ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
     ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
-    ('python 3', r'.*(hgext|mercurial).*(?<!pycompat)\.py', '',
+    ('python 3', r'.*(hgext|mercurial)/(?!pycompat).*\.py', '',
             pyfilters, py3pats),
     ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
     ('c', r'.*\.[ch]$', '', cfilters, cpats),


More information about the Mercurial-devel mailing list