##// END OF EJS Templates
extensions: prevent a crash on py3 with a `minimumhgversion` str value...
Matt Harbison -
r48829:5caec48d default
parent child Browse files
Show More
@@ -224,7 +224,7 b' def load(ui, name, path, loadingtime=Non'
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)
@@ -1692,12 +1692,13 b' Can load minimum version identical to cu'
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)
General Comments 0
You need to be logged in to leave comments. Login now