diff --git a/docs/benchmarks.rst b/docs/benchmarks.rst
index dd7ba631b8e3f07544caf217f836a9acd4def480_ZG9jcy9iZW5jaG1hcmtzLnJzdA==..1c8e5246dcdb76f16461ff3165d24eac56e6b955_ZG9jcy9iZW5jaG1hcmtzLnJzdA== 100644
--- a/docs/benchmarks.rst
+++ b/docs/benchmarks.rst
@@ -144,6 +144,19 @@
 
 a shell script to run before running the perf-command.
 
+constraints
+~~~~~~~~~~~
+
+Theses variables control when this benchmark can be run.
+
+Here is the list of currently supported constraints:
+
+- `graph.visible-revision-count.min=<integer>`:
+
+  Target repository must have at least that many visible revision for this
+  benchmark to run.
+
+
 variants
 --------
 
diff --git a/python-libs/poulpe/benchmarks.py b/python-libs/poulpe/benchmarks.py
index dd7ba631b8e3f07544caf217f836a9acd4def480_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk=..1c8e5246dcdb76f16461ff3165d24eac56e6b955_cHl0aG9uLWxpYnMvcG91bHBlL2JlbmNobWFya3MucHk= 100644
--- a/python-libs/poulpe/benchmarks.py
+++ b/python-libs/poulpe/benchmarks.py
@@ -13,6 +13,24 @@
 class UnknownBenchmarkMethod(KeyError):
     pass
 
+def _merge_constraint(core, new):
+    # XXX implement something proper sometime
+    t = core.get('graph', {})
+    t = t.get('visible-revision-count', {})
+    core_revs = t.get('min', None)
+
+    t = new.get('graph', {})
+    t = t.get('visible-revision-count', {})
+    new_revs = t.get('min', None)
+    if new_revs is None:
+        pass  # nothing to do
+    elif core_revs is None:
+        t = core.setdefault('graph', {})
+        t = t.setdefault('visible-revision-count', {})
+        t['min'] = new_revs
+    else:
+        core['graph']['visible-revision-count'] = min(new_revs, core_revs)
+
 
 def get_benchmark(path_def):
     """get a benchmark from path applying possible variant selection on the way
@@ -83,6 +101,19 @@
         return {}
 
     @property
+    def constraints(self):
+        c = {}
+        c['needed-vars'] = self.needed_vars
+        # XXX need to fetch graph constraint for the core variable too
+        min_rev = None
+
+        for dimension, variants in self.all_dimensions.items():
+            selected = self._selected_variants[dimension]
+            values = variants[selected]
+            _merge_constraint(c, values.get('constraints', {}))
+        return c
+
+    @property
     def needed_vars(self):
         return set()
 
diff --git a/suites/hg/benchmarks/perf-bundle.pbd b/suites/hg/benchmarks/perf-bundle.pbd
index dd7ba631b8e3f07544caf217f836a9acd4def480_c3VpdGVzL2hnL2JlbmNobWFya3MvcGVyZi1idW5kbGUucGJk..1c8e5246dcdb76f16461ff3165d24eac56e6b955_c3VpdGVzL2hnL2JlbmNobWFya3MvcGVyZi1idW5kbGUucGJk 100644
--- a/suites/hg/benchmarks/perf-bundle.pbd
+++ b/suites/hg/benchmarks/perf-bundle.pbd
@@ -15,6 +15,9 @@
 default=true
 args=["--rev", "last(all(), 40000)"]
 
+[hg-perf-ext.variants.dimensions.revs.last-40000.constraints.graph]
+visible-revision-count.min=40000
+
 [hg-perf-ext.variants.dimensions.revs.last-10000]
 args=["--rev", "last(all(), 10000)"]
 
@@ -18,6 +21,9 @@
 [hg-perf-ext.variants.dimensions.revs.last-10000]
 args=["--rev", "last(all(), 10000)"]
 
+[hg-perf-ext.variants.dimensions.revs.last-10000.constraints.graph]
+visible-revision-count.min=10000
+
 [hg-perf-ext.variants.dimensions.revs.last-1000]
 args=["--rev", "last(all(), 1000)"]
 
@@ -21,6 +27,9 @@
 [hg-perf-ext.variants.dimensions.revs.last-1000]
 args=["--rev", "last(all(), 1000)"]
 
+[hg-perf-ext.variants.dimensions.revs.last-1000.constraints.graph]
+visible-revision-count.min=1000
+
 [hg-perf-ext.variants.dimensions.revs.last-100]
 args=["--rev", "last(all(), 100)"]
 
@@ -24,6 +33,9 @@
 [hg-perf-ext.variants.dimensions.revs.last-100]
 args=["--rev", "last(all(), 100)"]
 
+[hg-perf-ext.variants.dimensions.revs.last-100.constraints.graph]
+visible-revision-count.min=100
+
 [hg-perf-ext.variants.dimensions.revs.last-10]
 args=["--rev", "last(all(), 10)"]
 
@@ -27,5 +39,8 @@
 [hg-perf-ext.variants.dimensions.revs.last-10]
 args=["--rev", "last(all(), 10)"]
 
+[hg-perf-ext.variants.dimensions.revs.last-10.constraints.graph]
+visible-revision-count.min=10
+
 [hg-perf-ext.variants.dimensions.revs.last-1]
 args=["--rev", "last(all(), 1)"]
@@ -30,2 +45,5 @@
 [hg-perf-ext.variants.dimensions.revs.last-1]
 args=["--rev", "last(all(), 1)"]
+
+[hg-perf-ext.variants.dimensions.revs.last-1.constraints.graph]
+visible-revision-count.min=1
diff --git a/suites/hg/benchmarks/perf-unbundle.pbd b/suites/hg/benchmarks/perf-unbundle.pbd
index dd7ba631b8e3f07544caf217f836a9acd4def480_c3VpdGVzL2hnL2JlbmNobWFya3MvcGVyZi11bmJ1bmRsZS5wYmQ=..1c8e5246dcdb76f16461ff3165d24eac56e6b955_c3VpdGVzL2hnL2JlbmNobWFya3MvcGVyZi11bmJ1bmRsZS5wYmQ= 100644
--- a/suites/hg/benchmarks/perf-unbundle.pbd
+++ b/suites/hg/benchmarks/perf-unbundle.pbd
@@ -14,7 +14,10 @@
 [hg-perf-ext.variants.dimensions.revs.last-35000]
 default=true
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 35000)' --base 'not last(all(), 35000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 35000)'; hg debugupdatecache"
+[hg-perf-ext.variants.dimensions.revs.last-35000.constraints.graph]
+visible-revision-count.min=35000
+
 
 [hg-perf-ext.variants.dimensions.revs.last-10000]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10000)' --base 'not last(all(), 10000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10000)'; hg debugupdatecache"
 
@@ -17,6 +20,9 @@
 
 [hg-perf-ext.variants.dimensions.revs.last-10000]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10000)' --base 'not last(all(), 10000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10000)'; hg debugupdatecache"
 
+[hg-perf-ext.variants.dimensions.revs.last-10000.constraints.graph]
+visible-revision-count.min=10000
+
 [hg-perf-ext.variants.dimensions.revs.last-1000]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1000)' --base 'not last(all(), 1000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1000)'; hg debugupdatecache"
@@ -21,5 +27,7 @@
 [hg-perf-ext.variants.dimensions.revs.last-1000]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1000)' --base 'not last(all(), 1000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1000)'; hg debugupdatecache"
+[hg-perf-ext.variants.dimensions.revs.last-1000.constraints.graph]
+visible-revision-count.min=1000
 
 [hg-perf-ext.variants.dimensions.revs.last-100]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 100)' --base 'not last(all(), 100)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 100)'; hg debugupdatecache"
@@ -23,6 +31,8 @@
 
 [hg-perf-ext.variants.dimensions.revs.last-100]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 100)' --base 'not last(all(), 100)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 100)'; hg debugupdatecache"
+[hg-perf-ext.variants.dimensions.revs.last-100.constraints.graph]
+visible-revision-count.min=100
 
 [hg-perf-ext.variants.dimensions.revs.last-10]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10)' --base 'not last(all(), 10)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10)'; hg debugupdatecache"
@@ -26,6 +36,8 @@
 
 [hg-perf-ext.variants.dimensions.revs.last-10]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10)' --base 'not last(all(), 10)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10)'; hg debugupdatecache"
+[hg-perf-ext.variants.dimensions.revs.last-10.constraints.graph]
+visible-revision-count.min=10
 
 [hg-perf-ext.variants.dimensions.revs.last-1]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1)' --base 'not last(all(), 1)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1)'; hg debugupdatecache"
@@ -29,3 +41,5 @@
 
 [hg-perf-ext.variants.dimensions.revs.last-1]
 setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1)' --base 'not last(all(), 1)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1)'; hg debugupdatecache"
+[hg-perf-ext.variants.dimensions.revs.last-1.constraints.graph]
+visible-revision-count.min=1
diff --git a/suites/hg/scheduling/auto-cases b/suites/hg/scheduling/auto-cases
index dd7ba631b8e3f07544caf217f836a9acd4def480_c3VpdGVzL2hnL3NjaGVkdWxpbmcvYXV0by1jYXNlcw==..1c8e5246dcdb76f16461ff3165d24eac56e6b955_c3VpdGVzL2hnL3NjaGVkdWxpbmcvYXV0by1jYXNlcw== 100755
--- a/suites/hg/scheduling/auto-cases
+++ b/suites/hg/scheduling/auto-cases
@@ -129,8 +129,9 @@
 
 
 def benchmark_compatible_with(base_dir, data_env, changeset, benchmark):
-    for v in benchmark.needed_vars:
+    constraints = benchmark.constraints
+    for v in constraints['needed-vars']:
         try:
             data_env.get_benchmark_input_vars(v)
         except errors.MissingDataEnvInputVars:
             return False
@@ -133,7 +134,20 @@
         try:
             data_env.get_benchmark_input_vars(v)
         except errors.MissingDataEnvInputVars:
             return False
+    t = constraints.get('graph', {})
+    t = t.get('visible-revision-count', {})
+    min_revs = t.get('min', None)
+    if min_revs is not None:
+        data_var = data_env.data_env_vars
+        t = data_var.get('mercurial', {})
+        t = t.get('repo', {})
+        t = t.get('graph', {})
+        revs = t.get('visible-revision-count')
+        if revs is None:
+            return False # we can't know
+        if min_revs > revs:
+            return False
     return True