extensions: don't get confused by aliasing between "foo" and "hgext.foo"
authorBryan O'Sullivan <bos@serpentine.com>
Mon, 30 Jul 2007 14:53:03 -0700
changeset 5031 af0995261f02
parent 5030 c89671c3b062
child 5032 6dbd40b6307c
extensions: don't get confused by aliasing between "foo" and "hgext.foo"
mercurial/extensions.py
--- a/mercurial/extensions.py	Mon Jul 30 20:06:11 2007 +0200
+++ b/mercurial/extensions.py	Mon Jul 30 14:53:03 2007 -0700
@@ -24,7 +24,11 @@
         raise KeyError(name)
 
 def load(ui, name, path):
-    if name in _extensions:
+    if name.startswith('hgext.'):
+        shortname = name[6:]
+    else:
+        shortname = name
+    if shortname in _extensions:
         return
     if path:
         # the module will be loaded in sys.modules
@@ -49,7 +53,7 @@
             mod = importh("hgext.%s" % name)
         except ImportError:
             mod = importh(name)
-    _extensions[name] = mod
+    _extensions[shortname] = mod
 
     uisetup = getattr(mod, 'uisetup', None)
     if uisetup: