[PATCH STABLE] dispatch: handle empty `testedwith` value in extension

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Fri Jan 4 06:43:21 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357295150 -3600
# Node ID b52aaf2669365850649775170131b5d221e3d4c2
# Parent  c565761dde6aa1a70b688cd2eebad69e9b5a16db
dispatch: handle empty `testedwith` value in extension

When extensions had an empty `testedwith` attribute the code tried to parse it
and failed. As a result the actual error were shallowed by a This crash.

We now treat empty strip as 'unknown'

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -215,15 +215,15 @@ def _runcatch(req):
         # version number and try updating.
         compare = myver.split('+')[0]
         ct = tuplever(compare)
         worst = None, ct, ''
         for name, mod in extensions.extensions():
-            testedwith = getattr(mod, 'testedwith', 'unknown')
+            testedwith = getattr(mod, 'testedwith', '')
             report = getattr(mod, 'buglink', _('the extension author.'))
-            if testedwith == 'unknown':
+            if not testedwith.strip():
                 # We found an untested extension. It's likely the culprit.
-                worst = name, testedwith, report
+                worst = name, 'unknown', report
                 break
             if compare not in testedwith.split() and testedwith != 'internal':
                 tested = [tuplever(v) for v in testedwith.split()]
                 lower = [t for t in tested if t < ct]
                 nearest = max(lower or tested)


More information about the Mercurial-devel mailing list