Mercurial > hg-stable
changeset 18224:0f9013112eba stable
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'
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 04 Jan 2013 19:06:42 +0100 |
parents | 3b1005354440 |
children | 6a082e72df4e 40185df018d7 |
files | mercurial/dispatch.py tests/test-extension.t |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dispatch.py Wed Jan 02 13:59:07 2013 +0100 +++ b/mercurial/dispatch.py Fri Jan 04 19:06:42 2013 +0100 @@ -217,11 +217,11 @@ 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()]
--- a/tests/test-extension.t Wed Jan 02 13:59:07 2013 +0100 +++ b/tests/test-extension.t Fri Jan 04 19:06:42 2013 +0100 @@ -498,6 +498,16 @@ ** Python * (glob) ** Mercurial Distributed SCM * (glob) ** Extensions loaded: throw +empty declaration of supported version, extension complains: + $ echo "testedwith = ''" >> throw.py + $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' + ** Unknown exception encountered with possibly-broken third-party extension throw + ** 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. + ** Python * (glob) + ** Mercurial Distributed SCM (*) (glob) + ** Extensions loaded: throw If the extension specifies a buglink, show that: $ echo 'buglink = "http://example.com/bts"' >> throw.py $ rm -f throw.pyc throw.pyo