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