changeset 2405:4593d09e534d

pick a non-conflicting module name when loading an extension prefix the module name by 'hgext_' so that it doesn't conflict with any core python module (for example bisect -> hgext_bisect) fix issue271
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 07 Jun 2006 18:33:15 +0200
parents ffc3b2f1ab6a
children 4a678e408ce5
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Jun 05 16:48:24 2006 +0200
+++ b/mercurial/commands.py	Wed Jun 07 18:33:15 2006 +0200
@@ -3238,7 +3238,11 @@
     for x in u.extensions():
         try:
             if x[1]:
-                mod = imp.load_source(x[0], x[1])
+                # the module will be loaded in sys.modules
+                # choose an unique name so that it doesn't
+                # conflicts with other modules
+                module_name = "hgext_%s" % x[0].replace('.', '_')
+                mod = imp.load_source(module_name, x[1])
             else:
                 def importh(name):
                     mod = __import__(name)