Show More
@@ -71,6 +71,14 b' def loadpath(path, module_name):' | |||
|
71 | 71 | exc.filename = path # python does not fill this |
|
72 | 72 | raise |
|
73 | 73 | |
|
74 | def _importh(name): | |
|
75 | """import and return the <name> module""" | |
|
76 | mod = __import__(name) | |
|
77 | components = name.split('.') | |
|
78 | for comp in components[1:]: | |
|
79 | mod = getattr(mod, comp) | |
|
80 | return mod | |
|
81 | ||
|
74 | 82 | def load(ui, name, path): |
|
75 | 83 | if name.startswith('hgext.') or name.startswith('hgext/'): |
|
76 | 84 | shortname = name[6:] |
@@ -87,20 +95,14 b' def load(ui, name, path):' | |||
|
87 | 95 | # conflicts with other modules |
|
88 | 96 | mod = loadpath(path, 'hgext.%s' % name) |
|
89 | 97 | else: |
|
90 | def importh(name): | |
|
91 | mod = __import__(name) | |
|
92 | components = name.split('.') | |
|
93 | for comp in components[1:]: | |
|
94 | mod = getattr(mod, comp) | |
|
95 | return mod | |
|
96 | 98 | try: |
|
97 | mod = importh("hgext.%s" % name) | |
|
99 | mod = _importh("hgext.%s" % name) | |
|
98 | 100 | except ImportError as err: |
|
99 | 101 | ui.debug('could not import hgext.%s (%s): trying %s\n' |
|
100 | 102 | % (name, err, name)) |
|
101 | 103 | if ui.debugflag: |
|
102 | 104 | ui.traceback() |
|
103 | mod = importh(name) | |
|
105 | mod = _importh(name) | |
|
104 | 106 | |
|
105 | 107 | # Before we do anything with the extension, check against minimum stated |
|
106 | 108 | # compatibility. This gives extension authors a mechanism to have their |
General Comments 0
You need to be logged in to leave comments.
Login now