Patchwork [2,of,5] hghave: add checkrange function

login
register
mail settings
Submitter timeless@mozdev.org
Date April 1, 2016, 10:23 p.m.
Message ID <33d33a5d4a8a438aa7e7.1459549394@waste.org>
Download mbox | patch
Permalink /patch/14233/
State Superseded
Headers show

Comments

timeless@mozdev.org - April 1, 2016, 10:23 p.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1459515856 0
#      Fri Apr 01 13:04:16 2016 +0000
# Node ID 33d33a5d4a8a438aa7e7d0074964dd85865462d9
# Parent  0b49a4a6a7e2d139727fdf172f2242238733564b
hghave: add checkrange function

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -22,6 +22,19 @@ 
         return func
     return decorator
 
+def checkrange(name, desc, vers):
+    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': [],