Patchwork [3,of,5] demandimport: refactor processfromlist

login
register
mail settings
Submitter timeless
Date Sept. 21, 2016, 3:59 a.m.
Message ID <d750b7a37b860dedeea3.1474430373@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/16724/
State Accepted
Headers show

Comments

timeless - Sept. 21, 2016, 3:59 a.m.
# HG changeset patch
# User timeless <timeless@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

Patch

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