File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -103,12 +103,17 @@ def require_clean_and_up_to_date_repo() -> None:
103103
104104 git ("fetch" )
105105 git ("status" , "--porcelain" )
106- if not is_branch_synced_with_remote (develop_branch ):
107- raise ValueError (f"{ develop_branch } is not synced with origin/{ develop_branch } " )
108- if not is_branch_synced_with_remote (main_branch ):
109- raise ValueError (f"{ main_branch } is not synced with origin/{ main_branch } " )
110- if not is_ancestor (main_branch , develop_branch ):
111- raise ValueError (f"{ main_branch } is not an ancestor of { develop_branch } " )
106+ validate_is_synced_ancestor (ancestor = main_branch , descendent = develop_branch )
107+
108+
109+ def validate_is_synced_ancestor (ancestor : str , descendent : str ) -> None :
110+ """Returns whether the given ancestor is actually an up-to-date ancestor of the given descendent branch."""
111+ if not is_branch_synced_with_remote (branch = descendent ):
112+ raise ValueError (f"{ descendent } is not synced with origin/{ descendent } " )
113+ if not is_branch_synced_with_remote (branch = ancestor ):
114+ raise ValueError (f"{ ancestor } is not synced with origin/{ ancestor } " )
115+ if not is_ancestor (ancestor = ancestor , descendent = descendent ):
116+ raise ValueError (f"{ ancestor } is not an ancestor of { descendent } " )
112117
113118
114119def is_branch_synced_with_remote (branch : str ) -> bool :
You can’t perform that action at this time.
0 commit comments