[PATCH 3 of 5] demandimport: refactor processfromlist

timeless timeless at fmr.im
Tue Sep 20 23:59:33 EDT 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1474429251 0
#      Wed Sep 21 03:40:51 2016 +0000
# Node ID d750b7a37b860dedeea32f803c03f81ff005fed4
# Parent  982fe7cdb28bb263a96b1bc2c9c3b8aedb025ab6
# Available At https://bitbucket.org/timeless/mercurial-crew
#              hg pull https://bitbucket.org/timeless/mercurial-crew -r d750b7a37b86
demandimport: refactor processfromlist

diff -r 982fe7cdb28b -r d750b7a37b86 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,10 @@
                 mod = getattr(mod, comp)
             return mod
 
+        def processfromlist(mod, name, 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 +246,7 @@
                 mod = _hgextimport(_origimport, name, globals, locals,
                                    level=level)
 
-            for x in fromlist:
-                processfromitem(mod, x)
+            processfromlist(mod, name, fromlist)
 
             return mod
 
@@ -251,9 +254,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