Mercurial > hg
changeset 28758:44e076a12bd3
hghave: add checkvers function
author | timeless <timeless@mozdev.org> |
---|---|
date | Fri, 01 Apr 2016 13:04:16 +0000 |
parents | 93bf61913f33 |
children | 2348ca49aaee |
files | tests/hghave.py |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Mon Apr 04 02:17:36 2016 +0000 +++ b/tests/hghave.py Fri Apr 01 13:04:16 2016 +0000 @@ -23,6 +23,22 @@ return func return decorator +def checkvers(name, desc, vers): + """Registers a check function for each of a series of versions. + + vers can be a list or an iterator""" + def decorator(func): + def funcv(v): + def f(): + return func(v) + return f + for v in vers: + v = str(v) + f = funcv(v) + checks['%s%s' % (name, v.replace('.', ''))] = (f, desc % v) + return func + return decorator + def checkfeatures(features): result = { 'error': [],