[PATCH 2 of 2] extensions: suggest --config extensions.bad=! when bad fails
timeless at mozdev.org
timeless at mozdev.org
Thu Sep 10 19:32:20 CDT 2015
# HG changeset patch
# User timeless at mozdev.org
# Date 1441928905 14400
# Thu Sep 10 19:48:25 2015 -0400
# Node ID d7d94ed8a182092c2f667b915be972e9c1de9e0b
# Parent cc7fc4b67ea0880faa4f8d823ba8fc348f71c0f9
extensions: suggest --config extensions.bad=! when bad fails
There are lots of ways for extensions to fail, so users should
be given a hint about how to deal with them, instead of being
left to scratch their heads.
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -119,11 +119,13 @@
raise
except Exception as inst:
if path:
- ui.warn(_("*** failed to import extension %s from %s: %s\n")
- % (name, path, inst))
+ ui.warn(_("*** failed to import extension %s from %s: %s\n"
+ "(you can use '--config extensions.%s=!%s' to disable it)\n")
+ % (name, path, inst, name, path))
else:
- ui.warn(_("*** failed to import extension %s: %s\n")
- % (name, inst))
+ ui.warn(_("*** failed to import extension %s: %s\n"
+ "(you can use '--config extensions.%s=!' to disable it)\n")
+ % (name, inst, name))
ui.traceback()
for name in _order[newindex:]:
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -11,15 +11,19 @@
$ hg -q help help 2>&1 |grep extension
*** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+ (you can use '--config extensions.badext=!$TESTTMP/badext.py' to disable it)
*** failed to import extension badext2: No module named badext2
+ (you can use '--config extensions.badext2=!' to disable it)
show traceback
$ hg -q help help --traceback 2>&1 | egrep ' extension|^Exception|Traceback|ImportError'
*** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+ (you can use '--config extensions.badext=!$TESTTMP/badext.py' to disable it)
Traceback (most recent call last):
Exception: bit bucket overflow
*** failed to import extension badext2: No module named badext2
+ (you can use '--config extensions.badext2=!' to disable it)
Traceback (most recent call last):
ImportError: No module named badext2
@@ -30,11 +34,13 @@
> | grep -v '^ ' \
> | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not import'
*** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+ (you can use '--config extensions.badext=!$TESTTMP/badext.py' to disable it)
Traceback (most recent call last):
Exception: bit bucket overflow
could not import hgext.badext2 (No module named badext2): trying badext2
Traceback (most recent call last):
ImportError: No module named badext2
*** failed to import extension badext2: No module named badext2
+ (you can use '--config extensions.badext2=!' to disable it)
Traceback (most recent call last):
ImportError: No module named badext2
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -110,6 +110,7 @@
$ echo "mq=nonexistent" >> $HGRCPATH
$ hg help qrecord
*** failed to import extension mq from nonexistent: [Errno *] * (glob)
+ (you can use '--config extensions.mq=!nonexistent' to disable it)
hg qrecord [OPTION]... PATCH [FILE]...
interactively record a new patch
More information about the Mercurial-devel
mailing list