Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/extensions.py @ 48039:5caec48d9a01
extensions: prevent a crash on py3 with a `minimumhgversion` str value
The expectation is that this field is bytes, but unported extensions are a thing
and it shouldn't explode on a bad value. We already do this transformation in
the version reporting mechanism.
Differential Revision: https://phab.mercurial-scm.org/D11476
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Mon, 20 Sep 2021 14:21:18 -0400 |
parents | a9bedc56f025 |
children | c6d44457f7e3 |
comparison
equal
deleted
inserted
replaced
48038:a9bedc56f025 | 48039:5caec48d9a01 |
---|---|
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 extmin = util.versiontuple(minver, 2) | 227 extmin = util.versiontuple(stringutil.forcebytestr(minver), 2) |
228 | 228 |
229 if None in extmin: | 229 if None in extmin: |
230 extmin = (extmin[0] or 0, extmin[1] or 0) | 230 extmin = (extmin[0] or 0, extmin[1] or 0) |
231 | 231 |
232 if None in curver or extmin > curver: | 232 if None in curver or extmin > curver: |