compare-disco: add an option to skip the case
authorPierre-Yves DAVID <pierre-yves.david@octobus.net>
Sat, 04 Jun 2022 19:04:01 +0200
changeset 49461 ebbaf6a77807
parent 49460 3c026138f234
child 49462 ef0b0f94d2e5
compare-disco: add an option to skip the case If we already know the context, we can save a lot of display space by skipping the case. This also open the way to speedup to the way we specify the subsets. (the code is hacky, but this is a quicky and dirty debug script)
contrib/perf-utils/compare-discovery-case
--- a/contrib/perf-utils/compare-discovery-case	Sat Jun 04 18:58:07 2022 +0200
+++ b/contrib/perf-utils/compare-discovery-case	Sat Jun 04 19:04:01 2022 +0200
@@ -118,14 +118,19 @@
     local_case,
     remote_case,
     display_header=True,
+    display_case=True,
 ):
     case = (repo, local_case, remote_case)
     if display_header:
-        print(
-            "#",
-            "repo",
-            "local-subset",
-            "remote-subset",
+        pieces = ['#']
+        if display_case:
+            pieces += [
+                "repo",
+                "local-subset",
+                "remote-subset",
+            ]
+
+        pieces += [
             "discovery-variant",
             "roundtrips",
             "queries",
@@ -135,7 +140,8 @@
             "undecided-initial",
             "undecided-common",
             "undecided-missing",
-        )
+        ]
+        print(*pieces)
     for variant in VARIANTS_KEYS:
         res = process(case, VARIANTS[variant])
         revs = res["nb-revs"]
@@ -143,36 +149,31 @@
         common_heads = res["nb-common-heads"]
         roundtrips = res["total-roundtrips"]
         queries = res["total-queries"]
-        if 'tree-discovery' in variant:
-            print(
+        pieces = []
+        if display_case:
+            pieces += [
                 repo,
                 format_case(local_case),
                 format_case(remote_case),
-                variant,
-                roundtrips,
-                queries,
-                revs,
-                local_heads,
-                common_heads,
-            )
-        else:
+            ]
+        pieces += [
+            variant,
+            roundtrips,
+            queries,
+            revs,
+            local_heads,
+            common_heads,
+        ]
+        if 'tree-discovery' not in variant:
             undecided_common = res["nb-ini_und-common"]
             undecided_missing = res["nb-ini_und-missing"]
             undecided = undecided_common + undecided_missing
-            print(
-                repo,
-                format_case(local_case),
-                format_case(remote_case),
-                variant,
-                roundtrips,
-                queries,
-                revs,
-                local_heads,
-                common_heads,
+            pieces += [
                 undecided,
                 undecided_common,
                 undecided_missing,
-            )
+            ]
+        print(*pieces)
     return 0
 
 
@@ -200,6 +201,9 @@
     if '--no-header' in argv:
         kwargs['display_header'] = False
         argv = [a for a in argv if a != '--no-header']
+    if '--no-case' in argv:
+        kwargs['display_case'] = False
+        argv = [a for a in argv if a != '--no-case']
 
     if len(argv) != 4:
         usage = f'USAGE: {script_name} REPO LOCAL_CASE REMOTE_CASE'