Mercurial > public > mercurial-scm > hg
comparison mercurial/extensions.py @ 48015:a9bedc56f025
extensions: prevent a crash on py3 when testing a bad extension minimum
A `None` placeholder is populated for each missing component by
`util.versiontuple()`, which could safely be used with `>` on py2, but not py3.
I guess there's another hole here where if the string is entirely bogus (i.e no
numbers), it will be treated as 0.0, and always load. But that's always been
the case.
Differential Revision: https://phab.mercurial-scm.org/D11475
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 20 Sep 2021 14:16:10 -0400 |
parents | 7bafe40ab78a |
children | 5caec48d9a01 |
comparison
equal
deleted
inserted
replaced
48014:0dc4cc654d96 | 48015:a9bedc56f025 |
---|---|
222 # extensions short circuit when loaded with a known incompatible version | 222 # extensions short circuit when loaded with a known incompatible version |
223 # of Mercurial. | 223 # of Mercurial. |
224 minver = getattr(mod, 'minimumhgversion', None) | 224 minver = getattr(mod, 'minimumhgversion', None) |
225 if minver: | 225 if minver: |
226 curver = util.versiontuple(n=2) | 226 curver = util.versiontuple(n=2) |
227 | 227 extmin = util.versiontuple(minver, 2) |
228 if None in curver or util.versiontuple(minver, 2) > curver: | 228 |
229 if None in extmin: | |
230 extmin = (extmin[0] or 0, extmin[1] or 0) | |
231 | |
232 if None in curver or extmin > curver: | |
229 msg = _( | 233 msg = _( |
230 b'(third party extension %s requires version %s or newer ' | 234 b'(third party extension %s requires version %s or newer ' |
231 b'of Mercurial (current: %s); disabling)\n' | 235 b'of Mercurial (current: %s); disabling)\n' |
232 ) | 236 ) |
233 ui.warn(msg % (shortname, minver, util.version())) | 237 ui.warn(msg % (shortname, minver, util.version())) |