Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pegasus_cli/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 19 additions & 0 deletions tests/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading