8000 cherry_picker.py bug fixes by Mariatta · Pull Request #123 · python/core-workflow · GitHub
[go: up one dir, main page]

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
Bug fixes:
- only allow cherry_pick --continue if the current branch is a backport branch
- use `git rev-parse --abbrev-ref HEAD`
instead of `git symbolic-ref HEAD | sed 's!refs\/heads\/!!'` when retrieving branch names
  • Loading branch information
Mariatta committed Jun 14, 2017
commit 1b407efe5ef42ba9f9d134346e8a08f14b2969f3
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
0