Patchwork D9440: dispatch: print the version of each extension in the bug report, if available

login
register
mail settings
Submitter phabricator
Date Nov. 28, 2020, 4:49 a.m.
Message ID <differential-rev-PHID-DREV-g6pfcmhibbcwsagfd2po-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47719/
State Superseded
Headers show

Comments

phabricator - Nov. 28, 2020, 4:49 a.m.
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9440

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-extension.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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 @@ 
   ** 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 @@ 
   ** 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 @@ 
   ** 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 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 @@ 
   ** 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 @@ 
   ** 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 @@ 
   ** 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 @@ 
   ** 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 @@ 
   ** 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
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1307,12 +1307,22 @@ 
             + 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