##// END OF EJS Templates
hook: disable demandimport before importing hooks...
Dirkjan Ochtman -
r18111:d7c28954 default
parent child Browse files
Show More
@@ -7,7 +7,7
7
7
8 from i18n import _
8 from i18n import _
9 import os, sys
9 import os, sys
10 import extensions, util
10 import extensions, util, demandimport
11
11
12 def _pythonhook(ui, repo, name, hname, funcname, args, throw):
12 def _pythonhook(ui, repo, name, hname, funcname, args, throw):
13 '''call python hook. hook is callable object, looked up as
13 '''call python hook. hook is callable object, looked up as
@@ -35,13 +35,17 def _pythonhook(ui, repo, name, hname, f
35 sys.path = sys.path[:] + [modpath]
35 sys.path = sys.path[:] + [modpath]
36 modname = modfile
36 modname = modfile
37 try:
37 try:
38 demandimport.disable()
38 obj = __import__(modname)
39 obj = __import__(modname)
40 demandimport.enable()
39 except ImportError:
41 except ImportError:
40 e1 = sys.exc_type, sys.exc_value, sys.exc_traceback
42 e1 = sys.exc_type, sys.exc_value, sys.exc_traceback
41 try:
43 try:
42 # extensions are loaded with hgext_ prefix
44 # extensions are loaded with hgext_ prefix
43 obj = __import__("hgext_%s" % modname)
45 obj = __import__("hgext_%s" % modname)
46 demandimport.enable()
44 except ImportError:
47 except ImportError:
48 demandimport.enable()
45 e2 = sys.exc_type, sys.exc_value, sys.exc_traceback
49 e2 = sys.exc_type, sys.exc_value, sys.exc_traceback
46 if ui.tracebackflag:
50 if ui.tracebackflag:
47 ui.warn(_('exception from first failed import attempt:\n'))
51 ui.warn(_('exception from first failed import attempt:\n'))
General Comments 0
You need to be logged in to leave comments. Login now