comparison tests/test-extension.t @ 48016: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 e4acdf5d94a2
comparison
equal deleted inserted replaced
48015:a9bedc56f025 48016:5caec48d9a01
1690 > minimumhgversion = b'3.5' 1690 > minimumhgversion = b'3.5'
1691 > EOF 1691 > EOF
1692 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third' 1692 $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep '\(third'
1693 [1] 1693 [1]
1694 1694
1695 Don't explode on py3 with a bad version number 1695 Don't explode on py3 with a bad version number (both str vs bytes, and not enough
1696 parts)
1696 1697
1697 $ cat > minversion4.py << EOF 1698 $ cat > minversion4.py << EOF
1698 > from mercurial import util 1699 > from mercurial import util
1699 > util.version = lambda: b'3.5' 1700 > util.version = lambda: b'3.5'
1700 > minimumhgversion = b'3' 1701 > minimumhgversion = '3'
1701 > EOF 1702 > EOF
1702 $ hg --config extensions.minversion=minversion4.py version -v 1703 $ hg --config extensions.minversion=minversion4.py version -v
1703 Mercurial Distributed SCM (version 3.5) 1704 Mercurial Distributed SCM (version 3.5)
1704 (see https://mercurial-scm.org for more information) 1705 (see https://mercurial-scm.org for more information)
1705 1706