Patchwork D7004: import-checker: allow symbol imports from mercurial.pycompat

login
register
mail settings
Submitter phabricator
Date Oct. 6, 2019, 9:22 p.m.
Message ID <differential-rev-PHID-DREV-eklsbadktf4wacbjmtb5-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42047/
State Superseded
Headers show

Comments

phabricator - Oct. 6, 2019, 9:22 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently, the source transformer inserts
  `from mercurial.pycompat import delattr, getattr, hasattr, setattr, open, unicode`
  to the top of every file. As part of getting rid of the source transformer,
  we'll need to have source code call these wrappers directly. Rather than
  rewrite all call sites to call pycompat.*, I think it makes sense to import
  needed symbols via explicit imports. That requires loosening the import checker
  to allow this.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7004

AFFECTED FILES
  contrib/import-checker.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -30,6 +30,7 @@ 
     'mercurial.i18n',
     'mercurial.interfaces',
     'mercurial.node',
+    'mercurial.pycompat',
     # for revlog to re-export constant to extensions
     'mercurial.revlogutils.constants',
     'mercurial.revlogutils.flagutil',