Skip to content

Commit 9986be0

Browse files
committed
feat: swap to just having one validation function and no intermediary
1 parent de7042c commit 9986be0

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

scripts/util.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,25 +66,14 @@ def run_command(command: str, *args: str, ignore_error: bool = False) -> Optiona
6666

6767
def require_clean_and_up_to_date_repo() -> None:
6868
"""Checks if the repo is clean and up to date with any important branches."""
69-
if not is_repo_clean_and_up_to_date():
70-
typer.secho("The repo is either not clean or is not up to date.", fg="red")
71-
raise typer.Exit(code=1)
72-
73-
74-
def is_repo_clean_and_up_to_date() -> bool:
75-
"""Checks if the repo is clean and up to date with any important branches."""
76-
try:
77-
git("fetch")
78-
git("status", "--porcelain")
79-
if not is_branch_synced_with_remote("develop"):
80-
raise ValueError("develop is not synced with origin/develop")
81-
if not is_branch_synced_with_remote("main"):
82-
raise ValueError("main is not synced with origin/main")
83-
if not is_ancestor("main", "develop"):
84-
raise ValueError("main is not an ancestor of develop")
85-
return True
86-
except subprocess.CalledProcessError:
87-
return False
69+
git("fetch")
70+
git("status", "--porcelain")
71+
if not is_branch_synced_with_remote("develop"):
72+
raise ValueError("develop is not synced with origin/develop")
73+
if not is_branch_synced_with_remote("main"):
74+
raise ValueError("main is not synced with origin/main")
75+
if not is_ancestor("main", "develop"):
76+
raise ValueError("main is not an ancestor of develop")
8877

8978

9079
def is_branch_synced_with_remote(branch: str) -> bool:

0 commit comments

Comments
 (0)