Skip to content
Open
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
13 changes: 9 additions & 4 deletions tools/batchpr_manual_cruft_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"sunpy/mpl-animators",
"sunpy/sunkit-image",
"sunpy/sunkit-pyvista",
"sunpy/sunpy-soar",
"sunpy/sunkit-instruments",
"sunpy/drms",
"sunpy/sunraster",
Expand All @@ -53,10 +52,16 @@ def __init__(self, token, author_name=None, author_email=None,
self.extra_context = extra_context

def process_repo(self):
if self.cleanup_remote_branch:
out = self.run_command(f"git ls-remote --heads origin {self.branch_name}")
if out:
out = self.run_command(f"git ls-remote --heads origin {self.branch_name}")
cleanup_remote_branch = self.cleanup_remote_branch
if out:
if not cleanup_remote_branch:
should_delete = input(f"Remote branch {self.branch_name} exists for {self.fork.full_name}, should I remove it? [y/N]").lower()
cleanup_remote_branch = should_delete == "y"

if cleanup_remote_branch:
self.run_command(f'git push https://{self.user.login}:{self.token}@github.com/{self.fork.full_name} :{self.branch_name}')

ret = update(skip_apply_ask=True, refresh_private_variables=True, extra_context=self.extra_context)
if not ret:
self.error(f"Cruft update failed for {self.repo}")
Expand Down