changeset 7011:7da76778dbd7

Do not try to load extensions twice (issue811)
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Tue, 09 Sep 2008 14:43:12 +0200
parents 9141bebefe3e
children 78341ea65d16
files mercurial/extensions.py tests/test-extension tests/test-extension.out
diffstat 3 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/extensions.py	Mon Sep 08 14:22:14 2008 +0200
+++ b/mercurial/extensions.py	Tue Sep 09 14:43:12 2008 +0200
@@ -29,7 +29,7 @@
         raise KeyError(name)
 
 def load(ui, name, path):
-    if name.startswith('hgext.'):
+    if name.startswith('hgext.') or name.startswith('hgext/'):
         shortname = name[6:]
     else:
         shortname = name
--- a/tests/test-extension	Mon Sep 08 14:22:14 2008 +0200
+++ b/tests/test-extension	Tue Sep 09 14:43:12 2008 +0200
@@ -80,3 +80,25 @@
 hg help debugextension
 hg --debug help debugextension
 echo 'debugextension = !' >> $HGRCPATH
+
+echo % issue811
+debugpath=`pwd`/debugissue811.py
+cat > debugissue811.py <<EOF
+'''show all loaded extensions
+'''
+from mercurial import extensions, commands
+
+def debugextensions(ui):
+    "yet another debug command"
+    ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
+
+cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
+commands.norepo += " debugextensions"
+EOF
+echo "debugissue811 = $debugpath" >> $HGRCPATH
+echo "mq=" >> $HGRCPATH
+echo "hgext.mq=" >> $HGRCPATH
+echo "hgext/mq=" >> $HGRCPATH
+
+echo % show extensions
+hg debugextensions
--- a/tests/test-extension.out	Mon Sep 08 14:22:14 2008 +0200
+++ b/tests/test-extension.out	Tue Sep 09 14:43:12 2008 +0200
@@ -57,3 +57,7 @@
     --profile         print command execution profile
     --version         output version information and exit
  -h --help            display help and exit
+% issue811
+% show extensions
+debugissue811
+mq