# HG changeset patch # User Matt Mackall # Date 1166389256 21600 # Node ID 693eec9570f36547aa5140d54c904fbc179181fa # Parent 6d0d025e125ad3a6ced148b697559a4878de9a87# Parent b12eae71382d29074385e82c5a34f2b7db2d9761 Merge with crew diff -r b12eae71382d -r 693eec9570f3 mercurial/demandimport.py --- a/mercurial/demandimport.py Sat Dec 16 23:36:06 2006 +0100 +++ b/mercurial/demandimport.py Sun Dec 17 15:00:56 2006 -0600 @@ -45,12 +45,18 @@ head, globals, locals, after = self._data mod = _origimport(head, globals, locals) # load submodules + def subload(mod, p): + h, t = p, None + if '.' in p: + h, t = p.split('.', 1) + if not hasattr(mod, h): + setattr(mod, h, _demandmod(p, mod.__dict__, mod.__dict__)) + else: + subload(getattr(mod, h), t) + for x in after: - hx = x - if '.' in x: - hx = x.split('.')[0] - if not hasattr(mod, hx): - setattr(mod, hx, _demandmod(x, mod.__dict__, mod.__dict__)) + subload(mod, x) + # are we in the locals dictionary still? if locals and locals.get(head) == self: locals[head] = mod