mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know of a lot of extensions using this, but it seems like useful info 
in
  a bug report.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1415,7 +1415,7 @@
 
 No declared supported version, extension complains:
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1427,7 +1427,7 @@
 the value is improperly a str instead of bytes):
   $ echo "testedwith = ''" >> throw.py
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1441,7 +1441,7 @@
   $ rm -f throw.pyc throw.pyo
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
@@ -1458,7 +1458,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older
+  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
   ** which supports versions 1.9 of Mercurial.
   ** Please disable older and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1472,7 +1472,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older
+  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
   ** which supports versions 1.9 of Mercurial.
   ** Please disable older and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1486,7 +1486,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions 2.1 of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1253,7 +1253,7 @@
     # of date) will be clueful enough to notice the implausible
     # version number and try updating.
     ct = util.versiontuple(n=2)
-    worst = None, ct, b''
+    worst = None, ct, b'', b''
     if ui.config(b'ui', b'supportcontact') is None:
         for name, mod in extensions.extensions():
             # 'testedwith' should be bytes, but not all extensions are ported
@@ -1261,10 +1261,11 @@
             testedwith = stringutil.forcebytestr(
                 getattr(mod, 'testedwith', b'')
             )
+            version = extensions.moduleversion(mod)
             report = getattr(mod, 'buglink', _(b'the extension author.'))
             if not testedwith.strip():
                 # We found an untested extension. It's likely the culprit.
-                worst = name, b'unknown', report
+                worst = name, b'unknown', report, version
                 break
 
             # Never blame on extensions bundled with Mercurial.
@@ -1278,20 +1279,21 @@
             lower = [t for t in tested if t < ct]
             nearest = max(lower or tested)
             if worst[0] is None or nearest < worst[1]:
-                worst = name, nearest, report
+                worst = name, nearest, report, version
     if worst[0] is not None:
-        name, testedwith, report = worst
+        name, testedwith, report, version = worst
         if not isinstance(testedwith, (bytes, str)):
             testedwith = b'.'.join(
                 [stringutil.forcebytestr(c) for c in testedwith]
             )
+        extver = version or _(b"(version N/A)")
         warning = _(
             b'** Unknown exception encountered with '
-            b'possibly-broken third-party extension %s\n'
+            b'possibly-broken third-party extension %s %s\n'
             b'** which supports versions %s of Mercurial.\n'
             b'** Please disable %s and try your action again.\n'
             b'** If that fixes the bug please report it to %s\n'
-        ) % (name, testedwith, name, stringutil.forcebytestr(report))
+        ) % (name, extver, testedwith, name, stringutil.forcebytestr(report))
     else:
         bugtracker = ui.config(b'ui', b'supportcontact')
         if bugtracker is None:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to