From 31e0a7da0b39f25e7965828133fde8ef33976e94 Mon Sep 17 00:00:00 2001 From: Cory Zue Date: Fri, 30 Oct 2026 13:56:22 +0200 Subject: [PATCH] Show a clear message when a push has no changes The server now reports a push that matches the last one as a success with {"no_changes": true}, which fell through to "Push completed successfully." Co-Authored-By: Claude Opus 5.5 --- pegasus_cli/projects.py | 5 +++++ tests/test_projects.py | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pegasus_cli/projects.py b/pegasus_cli/projects.py index 2203232..525a703 100644 --- a/pegasus_cli/projects.py +++ b/pegasus_cli/projects.py @@ -570,6 +570,11 @@ def push(ctx, project_id, upgrade, dev, no_upgrade, pr_title): click.echo(f"\nPull request created: {pr_url}") elif repo_url: click.echo(f"\nRepository created: {repo_url}") + elif task_result.get("no_changes"): + click.echo( + "\nAlready up to date. This build matches your last " + "push, so no pull request was created." + ) else: click.echo("\nPush completed successfully.") else: diff --git a/tests/test_projects.py b/tests/test_projects.py index 64886bf..3124787 100644 --- a/tests/test_projects.py +++ b/tests/test_projects.py @@ -378,6 +378,25 @@ def test_push_shows_progress(self, mock_get_client): ) assert "Pull request created" in result.output + @patch("pegasus_cli.projects._get_client") + def test_push_no_changes(self, mock_get_client): + client = _mock_client( + poll_statuses=[ + { + "state": "SUCCESS", + "complete": True, + "success": True, + "result": {"no_changes": True}, + }, + ] + ) + mock_get_client.return_value = client + runner = CliRunner() + result = runner.invoke(cli, ["projects", "push", "1"], input="3\n") + assert result.exit_code == 0 + assert "Already up to date" in result.output + assert "Push completed successfully" not in result.output + @patch("pegasus_cli.projects._get_client") def test_push_failure(self, mock_get_client): client = _mock_client(