Use git branch -D for reference_branch

This commit allows the use of a reference_branch that is not merged into
the current working directory.

Imports have been sorted by isort
This commit is contained in:
Jan Dittberner 2022-09-17 10:12:09 +02:00 committed by Gitea
parent 424bd7954f
commit 11b092beb0

View file

@ -5,9 +5,9 @@
import argparse
import os
import tempfile
from subprocess import CalledProcessError, run
from sys import stderr
from email.message import EmailMessage, MIMEPart
from subprocess import DEVNULL, CalledProcessError, run
from sys import stderr
REFERENCE_BRANCH = "provisioned"
DEFAULT_BRANCH = "origin/main"
@ -246,7 +246,12 @@ def main(reference_branch, target_branch, audit_email_address, audit_sender_addr
changelog = get_changelog(reference_branch, target_branch)
run(["git", "branch", "-d", reference_branch], check=True)
run(
["git", "branch", "-D", reference_branch],
check=True,
stdout=DEVNULL,
stderr=DEVNULL,
)
run(["git", "branch", reference_branch, target_branch], check=True)
send_audit_mail(diffs, audit_email_address, audit_sender_address, changelog)