refactor: remove release prompts #15
@@ -36,8 +36,8 @@ COMMIT_TYPE_INCREMENT = {
|
|||||||
"feature": SEMVER_MINOR,
|
"feature": SEMVER_MINOR,
|
||||||
"bugfix": SEMVER_PATCH,
|
"bugfix": SEMVER_PATCH,
|
||||||
"hotfix": SEMVER_PATCH,
|
"hotfix": SEMVER_PATCH,
|
||||||
"refactor": SEMVER_SKIP,
|
"refactor": SEMVER_PATCH,
|
||||||
"perf": SEMVER_SKIP,
|
"perf": SEMVER_PATCH,
|
||||||
"docs": SEMVER_SKIP,
|
"docs": SEMVER_SKIP,
|
||||||
"style": SEMVER_SKIP,
|
"style": SEMVER_SKIP,
|
||||||
"test": SEMVER_SKIP,
|
"test": SEMVER_SKIP,
|
||||||
|
|||||||
@@ -119,10 +119,6 @@ def create_pull_request(token: str, branch: str, target: str):
|
|||||||
|
|
||||||
base.io_success(message, "Rama creada")
|
base.io_success(message, "Rama creada")
|
||||||
|
|
||||||
if base.io_confirm("¿Desea cambiar a la rama objetivo y bajar los cambios?"):
|
|
||||||
Git("switch", target).exec(print="Cambiando a rama objetivo")
|
|
||||||
Git("pull").exec(print="Obteniendo cambios")
|
|
||||||
|
|
||||||
|
|
||||||
def _get_pr_title_from_branch(branch: str) -> str:
|
def _get_pr_title_from_branch(branch: str) -> str:
|
||||||
if branch in base.environments:
|
if branch in base.environments:
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
from typing import Optional
|
|
||||||
|
|
||||||
import typer
|
import typer
|
||||||
|
|
||||||
import git_flow.command.base as base
|
import git_flow.command.base as base
|
||||||
from git_flow import COMMIT_TYPES, GitFlowError
|
from git_flow import GitFlowError
|
||||||
from git_flow.git import Git
|
from git_flow.git import Git
|
||||||
|
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def release(group: Optional[str] = None):
|
def release():
|
||||||
"""Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
"""Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
||||||
base.ensure_initialized()
|
base.ensure_initialized()
|
||||||
|
|
||||||
@@ -44,45 +42,17 @@ def release(group: Optional[str] = None):
|
|||||||
for commit in commits:
|
for commit in commits:
|
||||||
print("- " + commit)
|
print("- " + commit)
|
||||||
|
|
||||||
grouping = group is not None
|
if has_remote and Git.get_tracking_branch(next_env):
|
||||||
|
Git("switch", next_env).exec(print="Cambiando a la rama objetivo")
|
||||||
if not group:
|
|
||||||
if base.io_confirm("¿Desea agrupar este release con otra rama?", False):
|
|
||||||
grouping = True
|
|
||||||
group = base.io_choice(
|
|
||||||
"Grupo release: ", Git.get_branches("release/" + next_env + "/")
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
group = next_env
|
|
||||||
|
|
||||||
if has_remote and Git.get_tracking_branch(group):
|
|
||||||
Git("switch", group).exec(print="Cambiando a la rama objetivo")
|
|
||||||
Git("pull").exec(print="Sincronizando cambios la rama objetivo")
|
Git("pull").exec(print="Sincronizando cambios la rama objetivo")
|
||||||
Git("switch", "-").exec(print="Volviendo a la rama original")
|
Git("switch", "-").exec(print="Volviendo a la rama original")
|
||||||
|
|
||||||
if len(commits) > 1 and base.io_confirm(
|
Git("switch", next_branch, create=True).exec(print="Creando rama release")
|
||||||
f"¿Desea reemplazar los {len(commits)} commits de la rama por uno solo?", False
|
|
||||||
):
|
|
||||||
base.io_info("Debe ingresar el mensaje del commit a crear.")
|
|
||||||
message = base.get_commit_message(COMMIT_TYPES[:-1])
|
|
||||||
|
|
||||||
Git("switch", next_branch, fork_point, create=True).exec(
|
status = Git("rebase", fork_point, next_branch, onto=next_env).code(
|
||||||
print="Creando rama release en base"
|
|
||||||
)
|
|
||||||
Git("merge", branch, squash=True).exec(print="Squasheando commits en uno solo")
|
|
||||||
Git("commit", m=message).exec(print="Creando commit único")
|
|
||||||
else:
|
|
||||||
Git("switch", next_branch, create=True).exec(print="Creando rama release")
|
|
||||||
|
|
||||||
status = Git("rebase", fork_point, next_branch, onto=group).code(
|
|
||||||
print="Moviendo cambios hacia el siguiente ambiente"
|
print="Moviendo cambios hacia el siguiente ambiente"
|
||||||
)
|
)
|
||||||
|
|
||||||
if status:
|
if status:
|
||||||
Git("rebase", abort=True).exec(print="Deshaciendo cambios por conflictos")
|
Git("rebase", abort=True).exec(print="Deshaciendo cambios por conflictos")
|
||||||
raise GitFlowError("Error al realizar pasaje de cambios a rama objetivo")
|
raise GitFlowError("Error al realizar pasaje de cambios a rama objetivo")
|
||||||
elif grouping:
|
|
||||||
Git("switch", group).exec(print="Cambiando a rama objetivo")
|
|
||||||
Git("merge", next_branch, ff_only=True).exec(
|
|
||||||
print="Mergeando cambios de la nueva rama"
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user