Skip to content

feat: added branch flag to deploy command - #306

Open
DriesDelanghe wants to merge 1 commit into
baloise:masterfrom
DriesDelanghe:feature/specify-pr-branch
Open

feat: added branch flag to deploy command#306
DriesDelanghe wants to merge 1 commit into
baloise:masterfrom
DriesDelanghe:feature/specify-pr-branch

Conversation

@DriesDelanghe

Copy link
Copy Markdown

Added a --branch flag to the deploy command

PR for issue #305

Comment thread docs/commands/deploy.md
Comment on lines +151 to +153
--branch BRANCH Specify the branch where the changes should be
committed to. If omitted with --create-pr, a random
branch is created.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
--branch BRANCH Specify the branch where the changes should be
committed to. If omitted with --create-pr, a random
branch is created.
--branch BRANCH Specify the branch where the changes should be
committed to. Creates a new branch if it doesn't exist yet.

nit: Mentioning the PR creation here is a bit confusing. I'd mention the branch flag in the PR flag instead.

Comment thread docs/commands/deploy.md
--git-provider-url GIT_PROVIDER_URL
Git provider base API URL (e.g. https://bitbucket.example.tld)
--create-pr [CREATE_PR]
Creates a Pull Request

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Creates a Pull Request from a random new branch. Use --branch to use a specific branch name instead.

see comment above

except GitError as ex:
raise GitOpsException(f"Error creating new branch '{branch}'.") from ex

def checkout(self, branch: str) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Instead of cloning main and then calling checkout/new_branch depending on __remote_branch_exists, couldn't we clone the branch directly when it already exists?

For example, call __remote_branch_exists first (using the clone URL rather than origin), then either clone(existing_branch) if it exists, or clone + new_branch if it doesn't.

This would avoid cloning main only to immediately switch to the requested branch, and should also avoid the additional fetch in the existing-branch case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants