perf: add support for stream-v3 during benchmark
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 06 Jun 2023 01:48:10 +0200
changeset 50675 3ce370a00225
parent 50674 b10c786b0145
child 50676 28620be88da9
perf: add support for stream-v3 during benchmark This is getting important as the v3 protocol will diverge from the v2 protocol.
contrib/perf.py
--- a/contrib/perf.py	Tue Jun 06 01:43:48 2023 +0200
+++ b/contrib/perf.py	Tue Jun 06 01:48:10 2023 +0200
@@ -1924,9 +1924,20 @@
             return data
 
         available[b'v2'] = generate
+    # try to fetch a v3 generator
+    generatev3 = getattr(mercurial.streamclone, "generatev3", None)
+    if generatev3 is not None:
+
+        def generate(repo):
+            entries, bytes, data = generatev3(repo, None, None, True)
+            return data
+
+        available[b'v3-exp'] = generate
+
     # resolve the request
     if version == b"latest":
-        latest_key = max(available)
+        # latest is the highest non experimental version
+        latest_key = max(v for v in available if b'-exp' not in v)
         return available[latest_key]
     elif version in available:
         return available[version]