Skip to content
Closed
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
5 changes: 5 additions & 0 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,10 @@ def land_pr(e: StackEntry, remote: str, target: str):
input=pr_body.encode(),
)

def abandon_pr(e: StackEntry):
Copy link
Collaborator

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).

log(b("Abandoning ") + e.pprint(), level=2)
Copy link
Collaborator

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):

Suggested change
log(b("Abandoning ") + e.pprint(), level=2)
log(b("Abandoning ") + e.pprint(False), level=2)


run_shell_command(["gh", "pr", "close", e.pr])
Copy link
Collaborator

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.


def delete_local_branches(st: List[StackEntry]):
log(h("Deleting local branches"), level=1)
Expand Down Expand Up @@ -1071,6 +1075,7 @@ def command_abandon(args: CommonArgs):

last_hash = ""
for e in st:
abandon_pr(e)
last_hash = strip_metadata(e)

log(h("Rebasing the current branch on top of updated top branch"), level=1)
Expand Down