From 0c35d8f08cca670da69b7d9ae19e3b2bf85bf2ad Mon Sep 17 00:00:00 2001 From: davidvujic Date: Wed, 16 Nov 2022 22:36:43 +0100 Subject: [PATCH 1/2] fix(bug): poly diff --short did only react to changes within the actual project folder --- components/polylith/diff/report.py | 27 +++++++++++++++++++++ components/polylith/poetry/commands/diff.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/components/polylith/diff/report.py b/components/polylith/diff/report.py index 82891c3c..bd16ab93 100644 --- a/components/polylith/diff/report.py +++ b/components/polylith/diff/report.py @@ -68,3 +68,30 @@ def print_diff_summary(tag: str, bases: List[str], components: List[str]) -> Non if bases: console.print(f"[base]Changed bases[/]: [data]{len(bases)}[/]") + + +def _changed_projects( + projects_data: List[dict], brick_type: str, bricks: List[str] +) -> set: + res = { + p["name"]: set(p.get(brick_type, [])).intersection(bricks) + for p in projects_data + } + + return {k for k, v in res.items() if v} + + +def print_short_diff( + projects_data: List[dict], + projects: List[str], + bases: List[str], + components: List[str], +) -> None: + + a = _changed_projects(projects_data, "components", components) + b = _changed_projects(projects_data, "bases", bases) + + res = a | b | set(projects) + + console = Console(theme=info_theme) + console.print(",".join(res)) diff --git a/components/polylith/poetry/commands/diff.py b/components/polylith/poetry/commands/diff.py index e07a8e8a..18dfeaaa 100644 --- a/components/polylith/poetry/commands/diff.py +++ b/components/polylith/poetry/commands/diff.py @@ -39,7 +39,7 @@ def handle(self) -> int: short = self.option("short") if short: - self.line(",".join(projects)) + diff.report.print_short_diff(projects_data, projects, bases, components) else: diff.report.print_diff_summary(tag, bases, components) diff.report.print_detected_changes_in_projects(projects) From b4f35d15e85f150da1eda9c577e8ec159c086e60 Mon Sep 17 00:00:00 2001 From: davidvujic Date: Wed, 16 Nov 2022 22:39:58 +0100 Subject: [PATCH 2/2] bump poetry plugin to 1.0.5 --- projects/poetry_polylith_plugin/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/poetry_polylith_plugin/pyproject.toml b/projects/poetry_polylith_plugin/pyproject.toml index 1674982f..9f321529 100644 --- a/projects/poetry_polylith_plugin/pyproject.toml +++ b/projects/poetry_polylith_plugin/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-polylith-plugin" -version = "1.0.4" +version = "1.0.5" description = "A Poetry plugin that adds tooling support for the Polylith Architecture" authors = ["David Vujic"] homepage = "https://github.com/davidvujic/python-polylith"