Improved error message for extensions overriding commands (with test):
authorThomas Arendsen Hein <thomas@intevation.de>
Tue, 26 Dec 2006 15:33:50 +0100
changeset 3990 96e21337dc03
parent 3989 e492ab235b4d
child 3991 da3dc89f1e9a
Improved error message for extensions overriding commands (with test): - Old text "module foo overrides bar" was misread as overriding module bar. - Only print a single warning line per extension instead of one for each command.
mercurial/commands.py
tests/test-bad-extension
tests/test-bad-extension.out
--- a/mercurial/commands.py	Tue Dec 26 14:54:48 2006 +0100
+++ b/mercurial/commands.py	Tue Dec 26 15:33:50 2006 +0100
@@ -3053,9 +3053,10 @@
         if uisetup:
             uisetup(ui)
         cmdtable = getattr(mod, 'cmdtable', {})
-        for t in cmdtable:
-            if t in table:
-                ui.warn(_("module %s overrides %s\n") % (name, t))
+        overrides = [cmd for cmd in cmdtable if cmd in table]
+        if overrides:
+            ui.warn(_("extension '%s' overrides commands: %s\n")
+                    % (name, " ".join(overrides)))
         table.update(cmdtable)
 
 def parseconfig(config):
--- a/tests/test-bad-extension	Tue Dec 26 14:54:48 2006 +0100
+++ b/tests/test-bad-extension	Tue Dec 26 15:33:50 2006 +0100
@@ -4,6 +4,8 @@
 abspath=`pwd`/badext.py
 
 echo '[extensions]' >> $HGRCPATH
+echo "gpg =" >> $HGRCPATH
+echo "hgext.gpg =" >> $HGRCPATH
 echo "badext = $abspath" >> $HGRCPATH
 
 hg -q help help
--- a/tests/test-bad-extension.out	Tue Dec 26 14:54:48 2006 +0100
+++ b/tests/test-bad-extension.out	Tue Dec 26 15:33:50 2006 +0100
@@ -1,4 +1,5 @@
 *** failed to import extension badext: invalid syntax (badext.py, line 1)
+extension 'hgext.gpg' overrides commands: sigs sigcheck sign
 hg help [COMMAND]
 
 show help for a command, extension, or list of commands