Mercurial > public > mercurial-scm > hg-stable
diff mercurial/demandimport.py @ 21025:54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Convenient for debugging weird problems that are caused by demandimport or
obfuscated by it.
This is an undocumented developer feature.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Tue, 08 Apr 2014 01:35:13 +0200 |
parents | aac87f70f38e |
children | 74be3fb1e3b8 |
line wrap: on
line diff
--- a/mercurial/demandimport.py Sun Apr 13 19:01:00 2014 +0200 +++ b/mercurial/demandimport.py Tue Apr 08 01:35:13 2014 +0200 @@ -24,7 +24,7 @@ b = __import__(a) ''' -import __builtin__ +import __builtin__, os _origimport = __import__ nothing = object() @@ -167,7 +167,8 @@ def enable(): "enable global demand-loading of modules" - __builtin__.__import__ = _demandimport + if os.environ.get('HGDEMANDIMPORT') != 'disable': + __builtin__.__import__ = _demandimport def disable(): "disable global demand-loading of modules"