refactor: inform instead of confirming current branch
This commit is contained in:
@@ -52,15 +52,14 @@ def ensure_initialized():
|
||||
)
|
||||
|
||||
|
||||
def ensure_right_branch():
|
||||
def ensure_on_branch():
|
||||
branch = Git.get_current_branch()
|
||||
|
||||
if branch == "HEAD":
|
||||
raise GitFlowError("No se encuentra parado sobre una rama.")
|
||||
elif io_confirm(f"Rama actual: {branch}. ¿Es correcto?"):
|
||||
return branch
|
||||
else:
|
||||
raise GitFlowError("Ejecución cancelada.")
|
||||
|
||||
io_info(f"Rama actual: {branch}")
|
||||
return branch
|
||||
|
||||
|
||||
def get_branch_env_and_type(branch: str) -> tuple[str, str]:
|
||||
|
||||
@@ -16,7 +16,7 @@ app = typer.Typer()
|
||||
def commit():
|
||||
"""Crea un commit siguiendo el formato de Conventional Commits"""
|
||||
base.ensure_initialized()
|
||||
branch = base.ensure_right_branch()
|
||||
branch = base.ensure_on_branch()
|
||||
|
||||
# Una rama WIP termina squasheando en su rama original, que tampoco puede ser un entorno
|
||||
target_branch = branch.removeprefix(WIP_BRANCH_PREFIX)
|
||||
|
||||
@@ -15,7 +15,7 @@ def merge():
|
||||
"""Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
||||
base.ensure_initialized()
|
||||
|
||||
branch = base.ensure_right_branch()
|
||||
branch = base.ensure_on_branch()
|
||||
|
||||
if branch in base.environments:
|
||||
if branch == base.environments[-1]:
|
||||
|
||||
@@ -14,7 +14,7 @@ def new():
|
||||
"""Crea una nueva rama siguiendo Conventional Branches"""
|
||||
|
||||
base.ensure_initialized()
|
||||
branch = base.ensure_right_branch()
|
||||
branch = base.ensure_on_branch()
|
||||
|
||||
if branch not in base.environments:
|
||||
base.io_warning("La rama actual no corresponde a un entorno configurado.")
|
||||
|
||||
@@ -12,7 +12,7 @@ def release():
|
||||
"""Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
||||
base.ensure_initialized()
|
||||
|
||||
branch = base.ensure_right_branch()
|
||||
branch = base.ensure_on_branch()
|
||||
env, _ = base.get_branch_env_and_type(branch)
|
||||
|
||||
if env == base.environments[-1]:
|
||||
|
||||
Reference in New Issue
Block a user