Compare commits

..
5 Commits
Author SHA1 Message Date
bitbucket-pipelines 2676f41def chore: bump version and update CHANGELOG.md [skip ci] 2026-05-20 20:14:50 +00:00
JonathanGitFlowandjt 22fd68c5b6 Merged in bugfix/dont-push-environment-branches-on-merge (pull request #73)
bugfix: dont push environment branches since they are already created on remote

Approved-by: Jonathan Teran
2026-05-20 20:14:08 +00:00
jt 04c9a4b449 bugfix: dont push environment branches since they are already created on remote 2026-05-20 17:13:34 -03:00
JonathanGitFlowandjt 417021b36e Merged in refactor/unify-flow-environments-usage (pull request #72)
refactor: unify flow branches usage

Approved-by: Jonathan Teran
2026-05-20 20:12:26 +00:00
jt be245114d5 refactor: unify flow branches usage 2026-05-20 17:10:58 -03:00
7 changed files with 19 additions and 17 deletions
+7
View File
@@ -1,3 +1,10 @@
## v1.17.1 - 2026-05-20
- **bugfix**: dont push environment branches since they are already created on remote [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (04c9a4b)
---
## v1.17.0 - 2026-05-20 ## v1.17.0 - 2026-05-20
- **feature**: allow merges between environments [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (5806aea) - **feature**: allow merges between environments [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (5806aea)
+4 -5
View File
@@ -18,7 +18,7 @@ TYPE_INFO = 3
flowconfig = Git.get_config(FLOWCONFIG_FILENAME) if isfile(FLOWCONFIG_FILENAME) else {} 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(): def ensure_initialized():
initialized = flowconfig["flow.initialized"] if flowconfig else None 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]: def get_branch_env_and_type(branch: str) -> tuple[str, str]:
components = branch.split("/") components = branch.split("/")
target_branches = flowconfig["flow.branches"].split(",")
if len(components) == 2: if len(components) == 2:
if components[0] not in BRANCH_TYPES: 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." 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: elif len(components) == 4:
target_branches = target_branches[1:] valid_environments = environments[1:]
if ( if (
components[0] != "release" components[0] != "release"
or components[1] not in target_branches or components[1] not in valid_environments
or components[2] not in BRANCH_TYPES or components[2] not in BRANCH_TYPES
): ):
raise GitFlowError( raise GitFlowError(
-1
View File
@@ -41,7 +41,6 @@ def branch(
ensure_initialized() ensure_initialized()
current_branch = Git.get_current_branch() current_branch = Git.get_current_branch()
environments = flowconfig["flow.branches"].split(",")
if current_branch in environments: if current_branch in environments:
current_environment = current_branch current_environment = current_branch
+1 -1
View File
@@ -13,7 +13,6 @@ def merge():
ensure_initialized() ensure_initialized()
branch = ensure_right_branch() branch = ensure_right_branch()
environments = flowconfig["flow.branches"].split(",")
if branch in environments: if branch in environments:
if branch == environments[-1]: if branch == environments[-1]:
@@ -50,6 +49,7 @@ def run_remote(remote: str, token: str, branch: str, target: str):
show_commits_to_merge(target) show_commits_to_merge(target)
if confirm(f"¿Crear PR de '{branch}' a '{target}'?"): if confirm(f"¿Crear PR de '{branch}' a '{target}'?"):
if branch not in environments:
Git("push", remote, branch, set_upstream=True).exec( Git("push", remote, branch, set_upstream=True).exec(
print="Subiendo rama al remoto para crear PR" print="Subiendo rama al remoto para crear PR"
) )
+1 -2
View File
@@ -13,9 +13,8 @@ def new():
ensure_initialized() ensure_initialized()
branch = ensure_right_branch() branch = ensure_right_branch()
envs = flowconfig["flow.branches"].split(",")
if branch not in envs: if branch not in environments:
warning("La rama actual no corresponde a un entorno configurado.") warning("La rama actual no corresponde a un entorno configurado.")
info("Se creará una nueva rama de trabajo sobre la rama actual.") info("Se creará una nueva rama de trabajo sobre la rama actual.")
+2 -3
View File
@@ -13,10 +13,9 @@ def release(group: Optional[str] = None):
ensure_initialized() ensure_initialized()
branch = ensure_right_branch() branch = ensure_right_branch()
envs = flowconfig["flow.branches"].split(",")
env, _ = get_branch_env_and_type(branch) env, _ = get_branch_env_and_type(branch)
if env == envs[-1]: if env == environments[-1]:
raise GitFlowError( raise GitFlowError(
"No se puede hacer release de una rama en el ultimo entorno." "No se puede hacer release de una rama en el ultimo entorno."
) )
@@ -25,7 +24,7 @@ def release(group: Optional[str] = None):
ensure_clean_worktree(has_remote) ensure_clean_worktree(has_remote)
next_env = envs[envs.index(env) + 1] next_env = environments[environments.index(env) + 1]
next_branch = ( next_branch = (
branch.replace(f"/{env}/", f"/{next_env}/") branch.replace(f"/{env}/", f"/{next_env}/")
if branch.startswith("release/") if branch.startswith("release/")
+1 -2
View File
@@ -20,10 +20,9 @@ def tag(token: Optional[str] = None):
"""Crea un nuevo tag para el último merge.""" """Crea un nuevo tag para el último merge."""
ensure_initialized() ensure_initialized()
envs = flowconfig["flow.branches"].split(",")
target = Git.get_current_branch() target = Git.get_current_branch()
if target not in envs: if target not in environments:
raise GitFlowError("Solo se pueden taggear commits en ramas principales.") raise GitFlowError("Solo se pueden taggear commits en ramas principales.")
branch = Git( branch = Git(