demandimport logic is incorrect
Created originally on Bitbucket by olliewalsh (Ollie Walsh)
The logic for demand import is incorrect. The end result is that demandimport is always enabled after importing mercurial-keyring, which causes major problems for everything imported afterwards.
#!python
# Temporarily disable demandimport to make the need of extending
# the list above less likely.
if __import__ == demandimport._import:
demandimport.disable()
try:
import keyring
finally:
demandimport.enable()
else:
import keyring
When demandimport is disabled, __import__ == demandimport._import
.(http://selenic.com/hg/file/a1eb21f5caea/mercurial/demandimport.py#l43)
That should be: __import__ == demandimport._demandimport
(http://selenic.com/hg/file/a1eb21f5caea/mercurial/demandimport.py#l170)