[PATCH 01 of 22] check-code: allow "from mercurial.(pure|cext) import x as y"
Augie Fackler
raf at durin42.com
Mon Jun 5 14:44:34 EDT 2017
On Sun, Jun 04, 2017 at 04:59:13PM -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1496444920 25200
> # Fri Jun 02 16:08:40 2017 -0700
> # Node ID 5c3500de0a229d8aa08058bccec531d8a85b90d9
> # Parent 783394c0c97807e83daad9da561179bd0719e159
> # Available At https://bitbucket.org/quark-zju/hg-draft
> # hg pull https://bitbucket.org/quark-zju/hg-draft -r 5c3500de0a22
> check-code: allow "from mercurial.(pure|cext) import x as y"
I don't see in the series where this ended up getting used. Did I just miss it?
>
> We want to forbid things like "from mercurial.cext import parsers". But
> sometimes it's useful to import a package directly. When that happens, the
> code probably wants an alternative name for the module using "as ...".
>
> This pattern will be used by the next patch.
>
> diff --git a/contrib/check-code.py b/contrib/check-code.py
> --- a/contrib/check-code.py
> +++ b/contrib/check-code.py
> @@ -342,5 +342,5 @@ pypats = [
> (r'^import BaseHTTPServer', "use util.httpserver instead"),
> (r'^(from|import) mercurial\.(cext|pure|cffi)',
> - "use mercurial.policy.importmod instead"),
> + "use mercurial.policy.importmod instead", r' as \S*$'),
> (r'\.next\(\)', "don't use .next(), use next(...)"),
> (r'([a-z]*).revision\(\1\.node\(',
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list