comparison mercurial/util.py @ 48036:376d08ae904f

util: eliminate the possibility of returning None from `versiontuple()` This fixes the following error flagged by pytype: File "/mnt/c/Users/Matt/hg/mercurial/extensions.py", line 228, in load: unsupported operand types for > [unsupported-operands] Primitive types 'Optional[tuple]' and 'curver: Optional[tuple]' are not comparable. Differential Revision: https://phab.mercurial-scm.org/D11473
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 20 Sep 2021 11:05:30 -0400
parents ae79611e3115
children 75fc2537d93c
comparison
equal deleted inserted replaced
48035:406a7e629946 48036:376d08ae904f
1222 return (vints[0], vints[1]) 1222 return (vints[0], vints[1])
1223 if n == 3: 1223 if n == 3:
1224 return (vints[0], vints[1], vints[2]) 1224 return (vints[0], vints[1], vints[2])
1225 if n == 4: 1225 if n == 4:
1226 return (vints[0], vints[1], vints[2], extra) 1226 return (vints[0], vints[1], vints[2], extra)
1227
1228 raise error.ProgrammingError(b"invalid version part request: %d" % n)
1227 1229
1228 1230
1229 def cachefunc(func): 1231 def cachefunc(func):
1230 '''cache the result of function calls''' 1232 '''cache the result of function calls'''
1231 # XXX doesn't handle keywords args 1233 # XXX doesn't handle keywords args