refactor: unify flow branches usage
This commit is contained in:
@@ -18,7 +18,7 @@ TYPE_INFO = 3
|
||||
|
||||
|
||||
flowconfig = Git.get_config(FLOWCONFIG_FILENAME) if isfile(FLOWCONFIG_FILENAME) else {}
|
||||
|
||||
environments = flowconfig["flow.branches"].split(",") if "flow.branches" in flowconfig else []
|
||||
|
||||
def ensure_initialized():
|
||||
initialized = flowconfig["flow.initialized"] if flowconfig else None
|
||||
@@ -46,7 +46,6 @@ def ensure_right_branch():
|
||||
|
||||
def get_branch_env_and_type(branch: str) -> tuple[str, str]:
|
||||
components = branch.split("/")
|
||||
target_branches = flowconfig["flow.branches"].split(",")
|
||||
|
||||
if len(components) == 2:
|
||||
if components[0] not in BRANCH_TYPES:
|
||||
@@ -54,13 +53,13 @@ def get_branch_env_and_type(branch: str) -> tuple[str, str]:
|
||||
f"Branch inválida, el tipo '{components[0]}' no es válido."
|
||||
)
|
||||
|
||||
return (target_branches[0], components[0])
|
||||
return (environments[0], components[0])
|
||||
elif len(components) == 4:
|
||||
target_branches = target_branches[1:]
|
||||
valid_environments = environments[1:]
|
||||
|
||||
if (
|
||||
components[0] != "release"
|
||||
or components[1] not in target_branches
|
||||
or components[1] not in valid_environments
|
||||
or components[2] not in BRANCH_TYPES
|
||||
):
|
||||
raise GitFlowError(
|
||||
|
||||
Reference in New Issue
Block a user