[Updated] D11821: extensions: highlight the name of the faulty extensions in the error message
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Tue Nov 30 15:14:18 UTC 2021
Closed by commit rHGe4acdf5d94a2: extensions: highlight the name of the faulty extensions in the error message (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11821?vs=31192&id=31208
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11821/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11821
AFFECTED FILES
mercurial/extensions.py
tests/test-bad-extension.t
tests/test-dispatch.t
tests/test-extension.t
tests/test-largefiles-misc.t
tests/test-lfs.t
tests/test-qrecord.t
tests/test-revset2.t
CHANGE DETAILS
diff --git a/tests/test-revset2.t b/tests/test-revset2.t
--- a/tests/test-revset2.t
+++ b/tests/test-revset2.t
@@ -1601,7 +1601,7 @@
> EOF
$ hg debugrevspec "custom1()"
- *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension
+ *** failed to import extension "custompredicate" from $TESTTMP/custompredicate.py: intentional failure of loading extension
hg: parse error: unknown identifier: custom1
[10]
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -117,7 +117,7 @@
$ echo "mq=nonexistent" >> $HGRCPATH
$ hg help qrecord
- *** failed to import extension mq from nonexistent: [Errno *] * (glob)
+ *** failed to import extension "mq" from nonexistent: [Errno *] * (glob)
hg qrecord [OPTION]... PATCH [FILE]...
interactively record a new patch
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -40,7 +40,7 @@
> EOF
$ hg config extensions
- \*\*\* failed to import extension lfs from missing.py: [Errno *] $ENOENT$: 'missing.py' (glob)
+ \*\*\* failed to import extension "lfs" from missing.py: [Errno *] $ENOENT$: 'missing.py' (glob)
abort: repository requires features unknown to this Mercurial: lfs
(see https://mercurial-scm.org/wiki/MissingRequirement for more information)
[255]
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -41,7 +41,7 @@
> EOF
$ hg config extensions
- \*\*\* failed to import extension largefiles from missing.py: [Errno *] $ENOENT$: 'missing.py' (glob)
+ \*\*\* failed to import extension "largefiles" from missing.py: [Errno *] $ENOENT$: 'missing.py' (glob)
abort: repository requires features unknown to this Mercurial: largefiles
(see https://mercurial-scm.org/wiki/MissingRequirement for more information)
[255]
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -649,7 +649,7 @@
module stub. Our custom lazy importer for Python 2 always returns a stub.
$ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}; hg --config extensions.checkrelativity=$TESTTMP/checkrelativity.py checkrelativity) || true
- *** failed to import extension checkrelativity from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist' (py3 !)
+ *** failed to import extension "checkrelativity" from $TESTTMP/checkrelativity.py: No module named 'extlibroot.lsub1.lsub2.notexist'
hg: unknown command 'checkrelativity' (py3 !)
(use 'hg help' for a list of commands) (py3 !)
@@ -1882,7 +1882,7 @@
> EOF
$ hg deprecatedcmd > /dev/null
- *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
+ *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
*** (use @command decorator to register 'deprecatedcmd')
hg: unknown command 'deprecatedcmd'
(use 'hg help' for a list of commands)
@@ -1891,7 +1891,7 @@
the extension shouldn't be loaded at all so the mq works:
$ hg qseries --config extensions.mq= > /dev/null
- *** failed to import extension deprecatedcmd from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
+ *** failed to import extension "deprecatedcmd" from $TESTTMP/deprecated/deprecatedcmd.py: missing attributes: norepo, optionalrepo, inferrepo
*** (use @command decorator to register 'deprecatedcmd')
$ cd ..
@@ -1939,7 +1939,7 @@
> test_unicode_default_value = $TESTTMP/test_unicode_default_value.py
> EOF
$ hg -R $TESTTMP/opt-unicode-default dummy
- *** failed to import extension test_unicode_default_value from $TESTTMP/test_unicode_default_value.py: unicode *'value' found in cmdtable.dummy (glob)
+ *** failed to import extension "test_unicode_default_value" from $TESTTMP/test_unicode_default_value.py: unicode 'value' found in cmdtable.dummy
*** (use b'' to make it byte string)
hg: unknown command 'dummy'
(did you mean summary?)
diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
--- a/tests/test-dispatch.t
+++ b/tests/test-dispatch.t
@@ -84,7 +84,7 @@
> raise Exception('bad')
> EOF
$ hg log -b '--config=extensions.bad=bad.py' default
- *** failed to import extension bad from bad.py: bad
+ *** failed to import extension "bad" from bad.py: bad
abort: option --config may not be abbreviated
[10]
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
@@ -52,16 +52,16 @@
> EOF
$ hg -q help help 2>&1 |grep extension
- *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
- *** failed to import extension badext2: No module named *badext2* (glob)
+ *** failed to import extension "badext" from $TESTTMP/badext.py: bit bucket overflow
+ *** failed to import extension "badext2": No module named 'badext2'
show traceback
$ hg -q help help --traceback 2>&1 | egrep ' extension|^Exception|Traceback|ImportError|ModuleNotFound'
- *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+ *** failed to import extension "badext" from $TESTTMP/badext.py: bit bucket overflow
Traceback (most recent call last):
Exception: bit bucket overflow
- *** failed to import extension badext2: No module named *badext2* (glob)
+ *** failed to import extension "badext2": No module named 'badext2'
Traceback (most recent call last):
ImportError: No module named badext2 (no-py3 !)
ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
@@ -101,7 +101,7 @@
YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: gpg
YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob)
YYYY/MM/DD HH:MM:SS (PID)> - loading extension: badext
- *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
+ *** failed to import extension "badext" from $TESTTMP/badext.py: bit bucket overflow
Traceback (most recent call last):
Exception: bit bucket overflow
YYYY/MM/DD HH:MM:SS (PID)> - loading extension: baddocext
@@ -123,7 +123,7 @@
Traceback (most recent call last): (py3 !)
ImportError: No module named 'hgext3rd.badext2' (py3 no-py36 !)
ModuleNotFoundError: No module named 'hgext3rd.badext2' (py36 !)
- *** failed to import extension badext2: No module named *badext2* (glob)
+ *** failed to import extension "badext2": No module named 'badext2'
Traceback (most recent call last):
ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
ModuleNotFoundError: No module named 'hgext.badext2' (py36 !)
@@ -160,8 +160,8 @@
confirm that there's no crash when an extension's documentation is bad
$ hg help --keyword baddocext
- *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
- *** failed to import extension badext2: No module named *badext2* (glob)
+ *** failed to import extension "badext" from $TESTTMP/badext.py: bit bucket overflow
+ *** failed to import extension "badext2": No module named 'badext2'
Topics:
extensions Using Additional Features
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -307,10 +307,12 @@
except Exception as inst:
msg = stringutil.forcebytestr(inst)
if path:
- error_msg = _(b"failed to import extension %s from %s: %s")
+ error_msg = _(
+ b'failed to import extension "%s" from %s: %s'
+ )
error_msg %= (name, path, msg)
else:
- error_msg = _(b"failed to import extension %s: %s")
+ error_msg = _(b'failed to import extension "%s": %s')
error_msg %= (name, msg)
ui.warn((b"*** %s\n") % error_msg)
if isinstance(inst, error.Hint) and inst.hint:
To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211130/aac8e818/attachment-0002.html>
More information about the Mercurial-patches
mailing list