Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: new --base option for git-* commands #419

Merged
merged 1 commit into from Oct 15, 2020

Conversation

tiborsimko
Copy link
Member

Adds new --base option to all git-* commands to facilitate working
against different git base branch, such as maint-0.7.

Adds new command git-checkout that allows to switch branches in many
components at one ago.

Renames old git-checkout to git-checkout-pr accordingly.

Fixes some parallel flake8-discovered warnings.

Closes #413.

Signed-off-by: Tibor Šimko tibor.simko@cern.ch

@tiborsimko tiborsimko self-assigned this Oct 5, 2020
default="master",
help="Against which git base branch are we working? [master]",
)
def git_create_release_commit(component, base, next_version=None):
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to add a click decorator to a normal function? I expected the following without decorator:

Suggested change
def git_create_release_commit(component, base, next_version=None):
def git_create_release_commit(component, base="master", next_version=None):

@@ -569,12 +638,17 @@ def git_checkout(branch, fetch): # noqa: D301
@click.option(
"--branch", "-b", nargs=2, multiple=True, help="Which PR? [component PR#]"
)
@click.option(
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about centralising this option like add_workflow_option in REANA-Client?

Do you think it would make sense to add the default branch value to config? I don't see why we would change it ever.. but at least it would be centralised.

Copy link
Member Author

Choose a reason for hiding this comment

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

All updated. I have also improved reporting in case base branch does not exist in origin/upstream. Example:

$ reana-dev git-status -c r-a-vomsproxy -s --base maint-0.7
ERROR: Branch upstream/maint-0.7 does not exist.
reana-auth-vomsproxy @ master @ a315022 release: v1.0.0

Copy link
Member

@diegodelemos diegodelemos left a comment

Choose a reason for hiding this comment

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

LGTM, not tested locally yet.

def is_feature_branch(component):
"""Check whether component current branch is different from master."""
return get_current_branch(get_srcdir(component)) != "master"
def is_feature_branch(component, base="master"):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def is_feature_branch(component, base="master"):
def is_feature_branch(component, base=GIT_DEFAULT_BASE_BRANCH):

@tiborsimko tiborsimko force-pushed the git-command-base-branch branch 2 times, most recently from ad4ebbd to 1c22b37 Compare October 14, 2020 14:50
Adds new `--base` option to all `git-*` commands to facilitate working
against different git base branch, such as `maint-0.7`.

Adds new command `git-checkout` that allows to switch branches in many
components at one ago.

Renames old `git-checkout` to `git-checkout-pr` accordingly.

Fixes some parallel flake8-discovered warnings.

Closes reanahub#413.

Signed-off-by: Tibor Šimko <tibor.simko@cern.ch>
@diegodelemos diegodelemos merged commit cda0a84 into reanahub:master Oct 15, 2020
@tiborsimko tiborsimko deleted the git-command-base-branch branch October 15, 2020 12:17
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.

cli: add base branch name option to git-* commands
2 participants