feature: agregando descripcion a ejecucion de comandos importantes en init y commit
This commit is contained in:
@@ -18,8 +18,8 @@ class CommitCommand(Command):
|
||||
|
||||
if not self._has_files_staged():
|
||||
self.warning("No hay cambios en el indice para commitear.")
|
||||
if self.confirm("¿Desea agregar la carpeta actual (`git add .`)?"):
|
||||
Git("add", ".").exec()
|
||||
if self.confirm("¿Desea agregar la carpeta actual?"):
|
||||
Git("add", ".").exec(print="Agregando cambios")
|
||||
else:
|
||||
raise GitFlowError(
|
||||
"Debe agregar algún cambio al indice para continuar."
|
||||
@@ -33,19 +33,19 @@ class CommitCommand(Command):
|
||||
|
||||
if branch.startswith("wip/"):
|
||||
original_branch = branch.removeprefix("wip/")
|
||||
Git("commit", m=message).exec()
|
||||
Git("commit", m=message).exec(print="Creando commit en rama WIP")
|
||||
|
||||
if commit_type != "wip":
|
||||
suffix = datetime.now().strftime("%Y%m%dT%H%M")
|
||||
Git("switch", original_branch).exec()
|
||||
Git("merge", branch, squash=True).exec()
|
||||
Git("commit", m=message).exec()
|
||||
Git("branch", branch, "trash/" + branch + "/" + suffix, move=True).exec()
|
||||
Git("switch", original_branch).exec(print="Volviendo a rama original")
|
||||
Git("merge", branch, squash=True).exec(print="Squasheando commits WIP en uno solo")
|
||||
Git("commit", m=message).exec(print="Creando commit final de rama WIP")
|
||||
Git("branch", branch, "trash/" + branch + "/" + suffix, move=True).exec(print="Backup de rama WIP")
|
||||
else:
|
||||
if commit_type == "wip":
|
||||
Git("switch", "wip/" + branch, create=True).exec()
|
||||
Git("switch", "wip/" + branch, create=True).exec(print="Creando nueva rama WIP")
|
||||
|
||||
Git("commit", m=message).exec()
|
||||
Git("commit", m=message).exec(print="Creando commit")
|
||||
|
||||
def _has_files_staged(self):
|
||||
status = Git.status()
|
||||
|
||||
@@ -45,15 +45,12 @@ class InitCommand(Command):
|
||||
Git("init").exec()
|
||||
|
||||
def _ensure_not_already_initialized(self):
|
||||
if os.path.isfile(FLOWCONFIG_FILE):
|
||||
flowconfig = Git.get_config(FLOWCONFIG_FILE)
|
||||
|
||||
if flowconfig["flow.initialized"] == "true":
|
||||
raise GitFlowError(
|
||||
"El repositorio ya fue inicializado para usar git-flow"
|
||||
)
|
||||
else:
|
||||
raise GitFlowError("Valor de 'flow.initialized' es inválido")
|
||||
if not self.flowconfig:
|
||||
return
|
||||
elif self.flowconfig.get("flow.initialized") == "true":
|
||||
raise GitFlowError("El repositorio ya fue inicializado para usar git-flow")
|
||||
else:
|
||||
raise GitFlowError("Valor de 'flow.initialized' es inválido")
|
||||
|
||||
def _setup_flow_branches(self):
|
||||
self.info(
|
||||
@@ -79,7 +76,7 @@ class InitCommand(Command):
|
||||
remote = None
|
||||
|
||||
if self.confirm("¿Configurar repositorio remoto?"):
|
||||
remotes = Git("remote").lines()
|
||||
remotes = Git("remote").lines(print="Listando remotos disponibles")
|
||||
|
||||
if not remotes:
|
||||
self.info("No tiene ningún repositorio remoto, se creará uno.")
|
||||
@@ -89,7 +86,7 @@ class InitCommand(Command):
|
||||
persistent=True,
|
||||
)
|
||||
remote = "origin"
|
||||
Git("remote", "add", remote, url).exec()
|
||||
Git("remote", "add", remote, url).exec(print="Agregando remoto")
|
||||
elif len(remotes) == 1:
|
||||
remote = remotes[0]
|
||||
else:
|
||||
@@ -98,7 +95,7 @@ class InitCommand(Command):
|
||||
|
||||
return remote
|
||||
|
||||
def _ensure_all_flow_branches_exist(self, branches: list[str], remote: str|None):
|
||||
def _ensure_all_flow_branches_exist(self, branches: list[str], remote: str | None):
|
||||
existing_branches = Git.get_branches()
|
||||
|
||||
if not all(map(lambda b: b in existing_branches, branches)):
|
||||
@@ -109,7 +106,11 @@ class InitCommand(Command):
|
||||
|
||||
for branch in branches:
|
||||
if branch not in existing_branches:
|
||||
Git("branch", branch, target_branch).exec()
|
||||
Git("branch", branch, target_branch).exec(
|
||||
print="Creando rama inexistente"
|
||||
)
|
||||
|
||||
if remote:
|
||||
Git("push", remote, branch, set_upstream=True).exec()
|
||||
Git("push", remote, branch, set_upstream=True).exec(
|
||||
print="Creando rama en remoto"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user