Skip to content

Commit 844b964

Browse files
committed
Use API for branch deletion
1 parent 5ba2c5f commit 844b964

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

llvm/utils/llvm_push_pr.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,7 @@ def _process_commit(
518518
):
519519
# After a merge, the temporary branch should be deleted from
520520
# the user's fork.
521-
delete_url = self._get_authenticated_remote_url(self.remote)
522-
self._run_cmd(
523-
["git", "push", delete_url, "--delete", merged_branch],
524-
check=False,
525-
)
521+
self.github_api.delete_branch(merged_branch)
526522
if temp_branch in self.created_branches:
527523
# If the branch was successfully merged, it should not be deleted
528524
# again during cleanup.
@@ -571,11 +567,8 @@ def _cleanup(self) -> None:
571567
self._run_cmd(["git", "checkout", self.original_branch], capture_output=True)
572568
if self.created_branches:
573569
self.runner.print("Cleaning up temporary remote branches...")
574-
delete_url = self._get_authenticated_remote_url(self.remote)
575-
self._run_cmd(
576-
["git", "push", delete_url, "--delete"] + self.created_branches,
577-
check=False,
578-
)
570+
for branch in self.created_branches:
571+
self.github_api.delete_branch(branch)
579572

580573

581574
def check_prerequisites(runner: CommandRunner) -> None:

0 commit comments

Comments
 (0)