D2866: contrib: fix a subtle bug in check-code's regex rewriting
This revision was automatically updated to reflect the committed changes. Closed by commit rHGac635637ed2f: contrib: fix a subtle bug in check-codes regex rewriting (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2866?vs=7044=7066 REVISION DETAIL https://phab.mercurial-scm.org/D2866 AFFECTED FILES contrib/check-code.py CHANGE DETAILS diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -542,8 +542,11 @@ for i, pseq in enumerate(pats): # fix-up regexes for multi-line searches p = pseq[0] -# \s doesn't match \n -p = re.sub(r'(?https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2866: contrib: fix a subtle bug in check-code's regex rewriting
pulkit accepted this revision. pulkit added a comment. Looks good to me but I am not feeling confident enough to push this. Queued the first three. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2866 To: durin42, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2866: contrib: fix a subtle bug in check-code's regex rewriting
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We rewrite `\s` to `[ \t]` when preparing our regular expressions, but we previously weren't working to avoid having nested sets. Previously, Python let this slide without incident, but in Python 3.7 wants to make sure you meant an actual [ in a set, and so this warns. This appears to be fortunate for us, because `[\s(]` was getting rewritten to be `[[ \t](]` which doesn't actually match what we expected. See preceding changes that were revealed to be necessary after implementing this fix. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2866 AFFECTED FILES contrib/check-code.py CHANGE DETAILS diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -542,8 +542,11 @@ for i, pseq in enumerate(pats): # fix-up regexes for multi-line searches p = pseq[0] -# \s doesn't match \n -p = re.sub(r'(?https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel