mercurial/demandload.py
author Bryan O'Sullivan <bos@serpentine.com>
Tue, 05 Jul 2005 18:22:28 -0800
changeset 630 a58af3932cee
parent 262 3db700146536
child 1826 f3abe0bdccdd
permissions -rw-r--r--
Remove debug print from locate code. # HG changeset patch # User Bryan O'Sullivan <bos@serpentine.com> # Node ID 5240abb57899b745f2e6465be29d9d54c4777364 # Parent 13b74665cbdf735a91f231956d0fe73e446340ea Remove debug print from locate code. Index: hg/mercurial/commands.py ===================================================================

def demandload(scope, modules):
    class d:
        def __getattr__(self, name):
            mod = self.__dict__["mod"]
            scope = self.__dict__["scope"]
            scope[mod] = __import__(mod, scope, scope, [])
            return getattr(scope[mod], name)

    for m in modules.split():
        dl = d()
        dl.mod = m
        dl.scope = scope
        scope[m] = dl