diff contrib/import-checker.py @ 44413:4cabeea6d214

hgext: start building a library for simple hooks Many workflows depend on hooks to enforce certain policies, e.g. to prevent forced pushes. The Mercurial Guide includes some cases and Google can help finding others, but it can save users a lot of time if hg itself has a couple of examples for further customization. Differential Revision: https://phab.mercurial-scm.org/D6825
author Joerg Sonnenberger <joerg@bec.de>
date Sat, 07 Sep 2019 14:50:39 +0200
parents 303576116ac1
children c102b704edb5
line wrap: on
line diff
--- a/contrib/import-checker.py	Tue Feb 25 20:27:39 2020 -0500
+++ b/contrib/import-checker.py	Sat Sep 07 14:50:39 2019 +0200
@@ -392,9 +392,10 @@
                     modnotfound = True
                     continue
                 yield found[1]
-            if modnotfound:
+            if modnotfound and dottedpath != modulename:
                 # "dottedpath" is a package, but imported because of non-module
                 # lookup
+                # specifically allow "from . import foo" from __init__.py
                 yield dottedpath