From 46c28883f7846f87f419c5c83e7c61e3cdea5d36 Mon Sep 17 00:00:00 2001 From: Niklas Fiekas Date: Fri, 4 Oct 2024 18:44:53 +0200 Subject: [PATCH] Revert "Removed unnecessary indentation blocks and updated conditional statements." This reverts commit 4a6dd9a89b7810312ab4ea1cf255d1a501ae09ca. --- release.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/release.py b/release.py index f2f7d81fa..d27ddf04e 100755 --- a/release.py +++ b/release.py @@ -10,7 +10,7 @@ def system(command): print(command) exit_code = os.system(command) - if exit_code: + if exit_code != 0: sys.exit(exit_code) @@ -21,7 +21,7 @@ def check_git(): system("git fetch origin") behind = int(subprocess.check_output(["git", "rev-list", "--count", "master..origin/master"])) - if behind: + if behind > 0: print(f"master is {behind} commit(s) behind origin/master") sys.exit(1) @@ -65,14 +65,15 @@ def tag_and_push(): release_txt.write(headline + os.linesep) for line in changelog_file: - if line.startswith("-------") and not first_section: - first_section = True + if not first_section: + if line.startswith("-------"): + first_section = True else: if line.startswith("-------"): break - - if not prev_line.startswith("------"): - release_txt.write(prev_line) + else: + if not prev_line.startswith("------"): + release_txt.write(prev_line) prev_line = line