Skip to content

cherry_picker.py bug fixes #123

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

Merged
merged 1 commit into from
Jun 14, 2017
Merged
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
7 changes: 3 additions & 4 deletions cherry_picker/cherry_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,7 @@ def continue_cherry_pick(self):
clean up branch
"""
cherry_pick_branch = get_current_branch()

if cherry_pick_branch != 'master':
if cherry_pick_branch.startswith('backport-'):
# amend the commit message, prefix with [X.Y]
base = get_base_branch(cherry_pick_branch)
short_sha = cherry_pick_branch[cherry_pick_branch.index('-')+1:cherry_pick_branch.index(base)-1]
Expand All @@ -246,7 +245,7 @@ def continue_cherry_pick(self):
click.echo(updated_commit_message)

else:
click.echo(u"Currently in `master` branch. Will not continue. \U0001F61B")
click.echo(f"Current branch ({cherry_pick_branch}) is not a backport branch. Will not continue. \U0001F61B")


CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
Expand Down Expand Up @@ -308,7 +307,7 @@ def get_current_branch():
"""
Return the current branch
"""
cmd = "git symbolic-ref HEAD | sed 's!refs\/heads\/!!'"
cmd = "git rev-parse --abbrev-ref HEAD"
output = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
return output.strip().decode('utf-8')

Expand Down