-
Notifications
You must be signed in to change notification settings - Fork 31
Actually abandon PRs #28
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
Conversation
The "abandon" command documents that it closes PRs tracked by the stack; however, it does not do that. This commit adds an abandon_pr routine and calls it during the abandon command for each entry in the stack.
ZolotukhinM
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contributions! I left a couple of comments on the implementation itself, but regarding this PR in particular I also have a high level question - do we actually need it provided #27 lands? IIUC github automatically closes the PR if its branch is closed. At least that's what I see in my testing - if I apply #27 I don't need this change to get the correct behavior.
| ) | ||
|
|
||
| def abandon_pr(e: StackEntry): | ||
| log(b("Abandoning ") + e.pprint(), level=2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pprint takes one argument (that controls whether we're printing PR as links in the terminal):
| log(b("Abandoning ") + e.pprint(), level=2) | |
| log(b("Abandoning ") + e.pprint(False), level=2) |
| def abandon_pr(e: StackEntry): | ||
| log(b("Abandoning ") + e.pprint(), level=2) | ||
|
|
||
| run_shell_command(["gh", "pr", "close", e.pr]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.pr can be empty (e.g. if a new commit has been added to the stack), so we should handle it here to prevent a crash.
| input=pr_body.encode(), | ||
| ) | ||
|
|
||
| def abandon_pr(e: StackEntry): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more comment: the code is organized in sections corresponding to top-level command (LAND/VIEW/SUBMIT/ABANDON). So this function probably should be moved to the "ABANDON" section (after line 1040).
I'll investigate this as soon as I can. If it is still needed, I'll address comments. |
You are correct, when I abandoned a PR and the remote is deleted, the PR auto-closes. I will close this PR. |
The "abandon" command documents that it
closes PRs tracked by the stack; however,
it does not do that. This commit adds
an abandon_pr routine and calls it during
the abandon command for each entry in
the stack.