# HG changeset patch # User Matt Harbison # Date 2020-11-27 20:54:46 # Node ID a120d1c9c70445ab2eba9f6c40415ffcb12b3560 # Parent d896c958e42800c16050e4b388abc90ca9649574 dispatch: print the version of each extension in the bug report, if available Sometimes the wrong extensions is blamed, so we might as well print the version info for all of them. Additionally, since the internal extensions are never blamed, this is a good way to make the pygit2 version available in a bug report. Differential Revision: https://phab.mercurial-scm.org/D9440 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -1307,12 +1307,22 @@ def _exceptionwarning(ui): + b'\n' ) sysversion = pycompat.sysbytes(sys.version).replace(b'\n', b'') + + def ext_with_ver(x): + ext = x[0] + ver = extensions.moduleversion(x[1]) + if ver: + ext += b' ' + ver + return ext + warning += ( (_(b"** Python %s\n") % sysversion) + (_(b"** Mercurial Distributed SCM (version %s)\n") % util.version()) + ( _(b"** Extensions loaded: %s\n") - % b", ".join([x[0] for x in sorted(extensions.extensions())]) + % b", ".join( + [ext_with_ver(x) for x in sorted(extensions.extensions())] + ) ) ) return warning diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -1421,7 +1421,7 @@ No declared supported version, extension ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM * (glob) - ** Extensions loaded: throw + ** Extensions loaded: throw 1.0.0 empty declaration of supported version, extension complains (but doesn't choke if the value is improperly a str instead of bytes): @@ -1433,7 +1433,7 @@ the value is improperly a str instead of ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) - ** Extensions loaded: throw + ** Extensions loaded: throw 1.0.0 If the extension specifies a buglink, show that (but don't choke if the value is improperly a str instead of bytes): @@ -1447,7 +1447,7 @@ improperly a str instead of bytes): ** If that fixes the bug please report it to http://example.com/bts ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) - ** Extensions loaded: throw + ** Extensions loaded: throw 1.0.0 If the extensions declare outdated versions, accuse the older extension first: $ echo "from mercurial import util" >> older.py @@ -1464,7 +1464,7 @@ If the extensions declare outdated versi ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM (version 2.2) - ** Extensions loaded: older, throw + ** Extensions loaded: older, throw 1.0.0 One extension only tested with older, one only with newer versions: $ echo "util.version = lambda:b'2.1'" >> older.py @@ -1478,7 +1478,7 @@ One extension only tested with older, on ** If that fixes the bug please report it to the extension author. ** Python * (glob) ** Mercurial Distributed SCM (version 2.1) - ** Extensions loaded: older, throw + ** Extensions loaded: older, throw 1.0.0 Older extension is tested with current version, the other only with newer: $ echo "util.version = lambda:b'1.9.3'" >> older.py @@ -1492,7 +1492,7 @@ Older extension is tested with current v ** If that fixes the bug please report it to http://example.com/bts ** Python * (glob) ** Mercurial Distributed SCM (version 1.9.3) - ** Extensions loaded: older, throw + ** Extensions loaded: older, throw 1.0.0 Ability to point to a different point $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ @@ -1501,7 +1501,7 @@ Ability to point to a different point ** Your Local Goat Lenders ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) - ** Extensions loaded: older, throw + ** Extensions loaded: older, throw 1.0.0 Declare the version as supporting this hg version, show regular bts link: $ hgver=`hg debuginstall -T '{hgver}'` @@ -1516,7 +1516,7 @@ Declare the version as supporting this h ** https://mercurial-scm.org/wiki/BugTracker ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) - ** Extensions loaded: throw + ** Extensions loaded: throw 1.0.0 Patch version is ignored during compatibility check $ echo "testedwith = b'3.2'" >> throw.py @@ -1528,7 +1528,7 @@ Patch version is ignored during compatib ** https://mercurial-scm.org/wiki/BugTracker ** Python * (glob) ** Mercurial Distributed SCM (*) (glob) - ** Extensions loaded: throw + ** Extensions loaded: throw 1.0.0 Test version number support in 'hg version': $ echo '__version__ = (1, 2, 3)' >> throw.py