Skip to content

Commit

Permalink
Show the cherry_picker command when backport failed (GH-30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariatta authored Sep 20, 2017
1 parent 04431bf commit d836752
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions backport/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,29 @@ def backport_task(commit_hash, branch, *, issue_number, created_by, merged_by):
print(f"pwd: {os.pwd()}, listdir: {os.listdir('.')}")
util.comment_on_pr(issue_number,
f"""{util.get_participants(created_by, merged_by)}, Something is wrong... I can't backport for now.
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.""")
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""")
cp = cherry_picker.CherryPicker('origin', commit_hash, [branch])
try:
cp.backport()
except cherry_picker.BranchCheckoutException:
util.comment_on_pr(issue_number,
f"""Sorry {util.get_participants(created_by, merged_by)}, I had trouble checking out the `{branch}` backport branch.
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.""")
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""")
cp.abort_cherry_pick()
except cherry_picker.CherryPickException:
util.comment_on_pr(issue_number,
f"""Sorry, {util.get_participants(created_by, merged_by)}, I could not cleanly backport this to `{branch}` due to a conflict.
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.""")
Please backport using [cherry_picker](https://pypi.org/project/cherry-picker/) on command line.
```
cherry_picker {commit_hash} {branch}
```
""")
cp.abort_cherry_pick()

0 comments on commit d836752

Please sign in to comment.