feature: agregando descripcion a ejecucion de comandos importantes en new, tag y merge
This commit is contained in:
@@ -29,14 +29,17 @@ class MergeCommand(Command):
|
|||||||
def run_remote(self, remote: str, token: str, base: str, branch: str, target: str):
|
def run_remote(self, remote: str, token: str, base: str, branch: str, target: str):
|
||||||
self.check_pending_changes(True)
|
self.check_pending_changes(True)
|
||||||
|
|
||||||
Git("switch", target).exec()
|
Git("switch", target).exec(print="Cambiando a rama destino")
|
||||||
Git("pull").exec()
|
Git("pull").exec(print="Obteniendo ultimos cambios del remoto")
|
||||||
Git("switch", "-").exec()
|
Git("switch", "-").exec(print="Volviendo a rama a mergear")
|
||||||
|
|
||||||
self.check_merge_conflicts(target)
|
self.check_merge_conflicts(target)
|
||||||
self.show_commits_to_merge(base)
|
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)
|
||||||
|
|
||||||
@@ -45,9 +48,9 @@ class MergeCommand(Command):
|
|||||||
self.check_merge_conflicts(target)
|
self.check_merge_conflicts(target)
|
||||||
self.show_commits_to_merge(base)
|
self.show_commits_to_merge(base)
|
||||||
|
|
||||||
if self.confirm(f"Mergear rama '{target}' <= '{branch}'?"):
|
if self.confirm(f"¿Mergear rama '{branch}' a '{target}'?"):
|
||||||
Git("switch", target).exec()
|
Git("switch", target).exec(print="Cambiando a rama destino")
|
||||||
Git("merge", branch, ff=False).exec()
|
Git("merge", branch, ff=False).exec(print="Mergeando")
|
||||||
|
|
||||||
def check_pending_changes(self, has_remote: bool):
|
def check_pending_changes(self, has_remote: bool):
|
||||||
status = Git.status()
|
status = Git.status()
|
||||||
@@ -78,10 +81,13 @@ class MergeCommand(Command):
|
|||||||
print("- " + commit)
|
print("- " + commit)
|
||||||
|
|
||||||
def check_merge_conflicts(self, target: str):
|
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:
|
if merge_conflicts:
|
||||||
Git("merge", abort=True).exec()
|
|
||||||
self.error(f"La rama actual tiene conflictos con {target}")
|
self.error(f"La rama actual tiene conflictos con {target}")
|
||||||
self.info(
|
self.info(
|
||||||
f"""Se recomienda mergear {target} a la rama actual, resolver los conflictos localmente, y ejecutar nuevamente este comando"""
|
f"""Se recomienda mergear {target} a la rama actual, resolver los conflictos localmente, y ejecutar nuevamente este comando"""
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class NewCommand(Command):
|
|||||||
new_branch = self._get_unique_branch_name(branch_type)
|
new_branch = self._get_unique_branch_name(branch_type)
|
||||||
|
|
||||||
if self.confirm(f"¿Crear rama '{new_branch}' sobre la rama actual?"):
|
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:
|
def _get_unique_branch_name(self, branch_type: str) -> str:
|
||||||
self.info(
|
self.info(
|
||||||
|
|||||||
@@ -43,17 +43,15 @@ class TagCommand(Command):
|
|||||||
changelog = Changelog()
|
changelog = Changelog()
|
||||||
|
|
||||||
changelog.update(next_tag, base, branch)
|
changelog.update(next_tag, base, branch)
|
||||||
Git("add", Changelog.FILENAME).exec()
|
Git("add", Changelog.FILENAME).exec(print="Agregando nuevo CHANGELOG.md")
|
||||||
Git("commit", message=Changelog.COMMIT_MESSAGE).exec()
|
Git("commit", message=Changelog.COMMIT_MESSAGE).exec(print="Creando commit")
|
||||||
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
tag_commit = Git("show", "HEAD", patch=False, format="%h").firstline()
|
||||||
|
|
||||||
self.check_not_tagged(tag_commit)
|
|
||||||
|
|
||||||
if ci:
|
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))
|
self.success(self.get_remote_api(token).create_tag(next_tag, tag_commit))
|
||||||
else:
|
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):
|
def get_token_and_ci(self, args: Namespace):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user