From fc99f7418ed9abb36b1977d241a69b796994e3ee Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Fri, 1 Nov 2024 18:44:13 +1300 Subject: [PATCH] Merge branches of the same release tree into the same row --- zashi-pipeline.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/zashi-pipeline.py b/zashi-pipeline.py index 002af258..db781f16 100644 --- a/zashi-pipeline.py +++ b/zashi-pipeline.py @@ -3,6 +3,7 @@ import networkx as nx from str2bool import str2bool as strtobool +import itertools import os import re from textwrap import wrap @@ -41,9 +42,17 @@ def build_release_matrix_from(dg, issue, repo_id): acc = [] for child in dg.neighbors(issue): if child.repo_id == repo_id and 'C-release' in child.labels: - child_releases = [] - for dep_repo in RELEASE_MATRIX.get(repo_id): - child_releases.extend(build_release_matrix_from(dg, child, dep_repo)) + # Fetch the rows that each child's downstreams need rendered. + child_deps = [ + build_release_matrix_from(dg, child, dep_repo) + for dep_repo in RELEASE_MATRIX.get(repo_id) + ] + + # Merge the rows from each downstream repo together. + child_releases = [ + {k: v for d in prod for k, v in d.items()} + for prod in itertools.product(*child_deps) + ] if len(child_releases) > 0: for rec in child_releases: