mercurial/demandload.py
author Thomas Arendsen Hein <thomas@intevation.de>
Sun, 26 Jun 2005 12:04:59 +0100
changeset 476 0a338d506268
parent 262 3db700146536
child 1826 f3abe0bdccdd
permissions -rw-r--r--
Really _call_ method revlog.count in revlog.lookup() -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Really _call_ method revlog.count in revlog.lookup() This fixes e.g. 'hg export 398737777' (exists in the mercurial repo). manifest hash: 9de9ad4c40d0746cb3db346a01c373e3b4aba54a -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCvovbW7P1GVgWeRoRAiyEAJ9gVZZiMGA3YItcWRHeai/9C+dMTgCbBiii QoFaXQ9wZDds8fVVsvENAYw= =msWK -----END PGP SIGNATURE-----

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