refactor: unify flow branches usage

This commit is contained in:
jt
2026-05-20 17:10:58 -03:00
parent 184b135886
commit be245114d5
6 changed files with 8 additions and 14 deletions
+4 -5
View File
@@ -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(