##// END OF EJS Templates
extensions: factor import error reporting out...
Pierre-Yves David -
r28506:10252652 default
parent child Browse files
Show More
@@ -79,6 +79,12 def _importh(name):
79 mod = getattr(mod, comp)
79 mod = getattr(mod, comp)
80 return mod
80 return mod
81
81
82 def _reportimporterror(ui, err, failed, next):
83 ui.debug('could not import %s (%s): trying %s\n'
84 % (failed, err, next))
85 if ui.debugflag:
86 ui.traceback()
87
82 def load(ui, name, path):
88 def load(ui, name, path):
83 if name.startswith('hgext.') or name.startswith('hgext/'):
89 if name.startswith('hgext.') or name.startswith('hgext/'):
84 shortname = name[6:]
90 shortname = name[6:]
@@ -98,10 +104,7 def load(ui, name, path):
98 try:
104 try:
99 mod = _importh("hgext.%s" % name)
105 mod = _importh("hgext.%s" % name)
100 except ImportError as err:
106 except ImportError as err:
101 ui.debug('could not import hgext.%s (%s): trying %s\n'
107 _reportimporterror(ui, err, "hgext.%s" % name, name)
102 % (name, err, name))
103 if ui.debugflag:
104 ui.traceback()
105 mod = _importh(name)
108 mod = _importh(name)
106
109
107 # Before we do anything with the extension, check against minimum stated
110 # Before we do anything with the extension, check against minimum stated
General Comments 0
You need to be logged in to leave comments. Login now