[PATCH 1 of 3 v2] demandimport: refactor processfromlist to ensure consistent handling
timeless
timeless at fmr.im
Wed Sep 21 18:09:40 UTC 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1474429251 0
# Wed Sep 21 03:40:51 2016 +0000
# Node ID 32a4cb17f935c570817249721401e0d62033987d
# Parent 982fe7cdb28bb263a96b1bc2c9c3b8aedb025ab6
# Available At https://bitbucket.org/timeless/mercurial-crew
# hg pull https://bitbucket.org/timeless/mercurial-crew -r 32a4cb17f935
demandimport: refactor processfromlist to ensure consistent handling
The next changeset will add a slow path for modules where certain
properties should be treated as not present.
In order to ensure that the codepath is handled the same for
absolute_import and relative import, this code should be in a single
location.
diff -r 982fe7cdb28b -r 32a4cb17f935 mercurial/demandimport.py
--- a/mercurial/demandimport.py Wed Sep 21 03:39:37 2016 +0000
+++ b/mercurial/demandimport.py Wed Sep 21 03:40:51 2016 +0000
@@ -220,6 +220,12 @@
mod = getattr(mod, comp)
return mod
+ def processfromlist(mod, name, fromlist):
+ # call processfromitem for each item in fromlist
+ if True:
+ for x in fromlist:
+ processfromitem(mod, x)
+
if level >= 0:
if name:
# "from a import b" or "from .a import b" style
@@ -242,8 +248,7 @@
mod = _hgextimport(_origimport, name, globals, locals,
level=level)
- for x in fromlist:
- processfromitem(mod, x)
+ processfromlist(mod, name, fromlist)
return mod
@@ -251,9 +256,7 @@
# party modules. So handle level == -1.
mod = _hgextimport(_origimport, name, globals, locals)
mod = chainmodules(mod, name)
-
- for x in fromlist:
- processfromitem(mod, x)
+ processfromlist(mod, name, fromlist)
return mod
More information about the Mercurial-devel
mailing list