# HG changeset patch # User Jun Wu # Date 2017-05-31 18:41:54 # Node ID 071423d0a584b6ad99f3d033b0acb56c34240d9f # Parent 5d44d7d4076e5a96001b0f88c730fa7ea24a9e02 check-code: suggest policy.importmod This forbids patterns like `from mercurial.cext import parsers` which breaks pure. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -340,6 +340,8 @@ pypats = [ (r'^import pickle', "don't use pickle, use util.pickle"), (r'^import httplib', "don't use httplib, use util.httplib"), (r'^import BaseHTTPServer', "use util.httpserver instead"), + (r'^(from|import) mercurial\.(cext|pure|cffi)', + "use mercurial.policy.importmod instead"), (r'\.next\(\)', "don't use .next(), use next(...)"), (r'([a-z]*).revision\(\1\.node\(', "don't convert rev to node before passing to revision(nodeorrev)"),