tests/hghave.py
changeset 28758 44e076a12bd3
parent 28757 93bf61913f33
child 28759 2348ca49aaee
--- 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': [],