From 4135a789e3231efa5ac0e50d8fc889a20518d82a Mon Sep 17 00:00:00 2001 From: Jonathan Teran Carballo Date: Sat, 22 Nov 2025 12:02:39 -0300 Subject: [PATCH] feature: agregando descripcion a ejecucion de comandos importantes en new, tag y merge --- src/git_flow/command/merge.py | 26 ++++++++++++++++---------- src/git_flow/command/new.py | 2 +- src/git_flow/command/tag.py | 10 ++++------ 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/git_flow/command/merge.py b/src/git_flow/command/merge.py index 70d8f79..716e097 100644 --- a/src/git_flow/command/merge.py +++ b/src/git_flow/command/merge.py @@ -29,25 +29,28 @@ class MergeCommand(Command): def run_remote(self, remote: str, token: str, base: str, branch: str, target: str): self.check_pending_changes(True) - Git("switch", target).exec() - Git("pull").exec() - Git("switch", "-").exec() + Git("switch", target).exec(print="Cambiando a rama destino") + Git("pull").exec(print="Obteniendo ultimos cambios del remoto") + Git("switch", "-").exec(print="Volviendo a rama a mergear") self.check_merge_conflicts(target) self.show_commits_to_merge(base) - Git("push", remote, branch, set_upstream=True).exec() + if self.confirm(f"¿Crear PR de '{branch}' a '{target}'?"): + Git("push", remote, branch, set_upstream=True).exec( + print="Subiendo rama al remoto para crear PR" + ) - self.create_pull_request(token, base, branch, target) + self.create_pull_request(token, base, branch, target) def run_local(self, base: str, branch: str, target: str): self.check_pending_changes(False) self.check_merge_conflicts(target) self.show_commits_to_merge(base) - if self.confirm(f"Mergear rama '{target}' <= '{branch}'?"): - Git("switch", target).exec() - Git("merge", branch, ff=False).exec() + if self.confirm(f"¿Mergear rama '{branch}' a '{target}'?"): + Git("switch", target).exec(print="Cambiando a rama destino") + Git("merge", branch, ff=False).exec(print="Mergeando") def check_pending_changes(self, has_remote: bool): status = Git.status() @@ -78,10 +81,13 @@ class MergeCommand(Command): print("- " + commit) def check_merge_conflicts(self, target: str): - merge_conflicts = Git("merge", target, ff=False, commit=False).code() != 0 + merge_conflicts = Git("merge", target, ff=False, commit=False).code( + print="Realizando merge de prueba para verificar conflictos" + ) + + Git("merge", abort=True).exec(print="Abortando merge de prueba") if merge_conflicts: - Git("merge", abort=True).exec() self.error(f"La rama actual tiene conflictos con {target}") self.info( f"""Se recomienda mergear {target} a la rama actual, resolver los conflictos localmente, y ejecutar nuevamente este comando""" diff --git a/src/git_flow/command/new.py b/src/git_flow/command/new.py index e5df5e9..8f23f92 100644 --- a/src/git_flow/command/new.py +++ b/src/git_flow/command/new.py @@ -22,7 +22,7 @@ class NewCommand(Command): new_branch = self._get_unique_branch_name(branch_type) if self.confirm(f"¿Crear rama '{new_branch}' sobre la rama actual?"): - Git("switch", new_branch, create=True).exec() + Git("switch", new_branch, create=True).exec(print="Creando nueva rama") def _get_unique_branch_name(self, branch_type: str) -> str: self.info( diff --git a/src/git_flow/command/tag.py b/src/git_flow/command/tag.py index 79233a7..eecfdde 100644 --- a/src/git_flow/command/tag.py +++ b/src/git_flow/command/tag.py @@ -43,17 +43,15 @@ class TagCommand(Command): changelog = Changelog() changelog.update(next_tag, base, branch) - Git("add", Changelog.FILENAME).exec() - Git("commit", message=Changelog.COMMIT_MESSAGE).exec() + Git("add", Changelog.FILENAME).exec(print="Agregando nuevo CHANGELOG.md") + Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print="Creando commit") tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline() - self.check_not_tagged(tag_commit) - if ci: - Git("push").exec() + Git("push").exec(print="Subiendo commit al remoto para taggearlo") self.success(self.get_remote_api(token).create_tag(next_tag, tag_commit)) else: - Git("tag", next_tag, tag_commit).exec() + Git("tag", next_tag, tag_commit).exec(print="Creando tag localmente") def get_token_and_ci(self, args: Namespace): try: