Skip to content
Snippets Groups Projects
Commit a9698da5 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

also take the branch into account and sort result "topologically"

parent c77efbb0
No related branches found
No related tags found
1 merge request!6also take the branch into account and sort result "topologically"
Pipeline #55362 passed
......@@ -22,10 +22,11 @@
benchmark -> hg-variant -> repo
"""
repo_func = partial(defaultdict, list)
hg_variant_func = partial(defaultdict, repo_func)
hg_branch_func = partial(defaultdict, repo_func)
hg_variant_func = partial(defaultdict, hg_branch_func)
benchmark_func = partial(defaultdict, hg_variant_func)
benchmarks = benchmark_func()
for r in results:
b_name = r["benchmark"]["name"]
flavor = r["bin-env-vars"]["hg"]["flavor"]
......@@ -26,7 +27,8 @@
benchmark_func = partial(defaultdict, hg_variant_func)
benchmarks = benchmark_func()
for r in results:
b_name = r["benchmark"]["name"]
flavor = r["bin-env-vars"]["hg"]["flavor"]
branch = r["bin-env-vars"]["hg"]["changeset"]["branch"]
repo = r["data-env-vars"]["name"]
......@@ -32,5 +34,11 @@
repo = r["data-env-vars"]["name"]
benchmarks[b_name][flavor][repo].append(r)
benchmarks[b_name][flavor][branch][repo].append(r)
for w in benchmarks.values():
for x in w.values():
for y in x.values():
for z in y.values():
z.sort(key=result_sort_key)
return benchmarks
......@@ -34,6 +42,38 @@
return benchmarks
def result_sort_key(result):
return parse_version(result["bin-env-vars"]["hg"]["version"])
def parse_version(version):
"""return a sortable key for a given hg_version"""
if "+" in version:
v_parts, rank_s = version.split(sep="+", maxsplit=1)
else:
v_parts = version
rank_s = "0"
rc = 100
pieces = []
if "rc" in v_parts:
v_parts, rc = v_parts.split(sep="rc", maxsplit=1)
v = v_parts.split(sep=".")
pieces.extend(int(x) for x in v)
while len(pieces) < 3:
pieces.append(0)
pieces.append(int(rc))
rank_s = rank_s.split(sep=".")[0]
rank_s = rank_s.split(sep="-")[0]
if "hg" in rank_s:
rank_s = rank_s.split(sep="hg", maxsplit=1)[1]
pieces.append(int(rank_s))
return tuple(pieces)
if __name__ == "__main__":
import json
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment