comparison mercurial/demandimport.py @ 20422:aac87f70f38e stable

hooks: only disable/re-enable demandimport when it's already enabled This fixes an issue introduced in d7c28954d901 where, when disabling demandimport while running hooks, it's inadvertently re-enabled even when it was never enabled in the first place. This doesn't affect normal command line usage of Mercurial; it only matters when Mercurial is run with demandimport intentionally disabled.
author Brodie Rao <brodie@sf.io>
date Mon, 10 Feb 2014 14:51:06 -0800
parents 621a26eb3a99
children 54af51c18c4c
comparison
equal deleted inserted replaced
20415:e4d7cbc94219 20422:aac87f70f38e
160 '_ssl', # conditional imports in the stdlib, issue1964 160 '_ssl', # conditional imports in the stdlib, issue1964
161 'rfc822', 161 'rfc822',
162 'mimetools', 162 'mimetools',
163 ] 163 ]
164 164
165 def isenabled():
166 return __builtin__.__import__ == _demandimport
167
165 def enable(): 168 def enable():
166 "enable global demand-loading of modules" 169 "enable global demand-loading of modules"
167 __builtin__.__import__ = _demandimport 170 __builtin__.__import__ = _demandimport
168 171
169 def disable(): 172 def disable():