[PATCH 2 of 2] check-code: detect legacy octal syntax

Augie Fackler raf at durin42.com
Wed Jun 24 07:46:48 CDT 2015


On Tue, Jun 23, 2015 at 10:41:04PM -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1435124301 25200
> #      Tue Jun 23 22:38:21 2015 -0700
> # Node ID 139ce3ea0c1c3fe46d4a185b6a9b0c8b55292757
> # Parent  7f0d2282983cf202b8a1d7667ff15a6e16ce1307
> check-code: detect legacy octal syntax

These are queued, thanks.

>
> Now that we have mass rewriting all files to use the modern octal
> syntax, detect and ban the legacy syntax, which is no longer supported
> in Python 3.
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -289,8 +289,9 @@ pypats = [
>      (r'release\(.*wlock, .*lock\)', "wrong lock release order"),
>      (r'\b__bool__\b', "__bool__ should be __nonzero__ in Python 2"),
>      (r'os\.path\.join\(.*, *(""|\'\')\)',
>       "use pathutil.normasprefix(path) instead of os.path.join(path, '')"),
> +    (r'\s0[0-7]+\b', 'legacy octal syntax; use "0o" prefix instead of "0"'),
>    ],
>    # warnings
>    [
>      (r'(^| )pp +xxxxqq[ \n][^\n]', "add two newlines after '.. note::'"),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list