changeset 50683:3ce370a00225

perf: add support for stream-v3 during benchmark This is getting important as the v3 protocol will diverge from the v2 protocol.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 06 Jun 2023 01:48:10 +0200
parents b10c786b0145
children 28620be88da9
files contrib/perf.py
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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]