feature: agrego comando release, elimino codigo no utilizado
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from argparse import Namespace, ArgumentParser
|
||||
from abc import ABC, abstractmethod
|
||||
import os
|
||||
from os.path import isfile
|
||||
|
||||
from git_flow import (
|
||||
@@ -45,6 +44,11 @@ class Command(ABC):
|
||||
def run(self, args: Namespace = Namespace()):
|
||||
pass
|
||||
|
||||
def init(self):
|
||||
self.flowconfig = (
|
||||
Git.get_config(FLOWCONFIG_FILE) if isfile(FLOWCONFIG_FILE) else {}
|
||||
)
|
||||
|
||||
def success(self, msg: str):
|
||||
self._print(TYPE_SUCCESS, msg)
|
||||
|
||||
@@ -145,7 +149,7 @@ class Command(ABC):
|
||||
raise GitFlowError("Ejecución cancelada.")
|
||||
|
||||
def ensure_repository_token(self):
|
||||
if not os.path.isfile(REPOSITORY_TOKEN_FILENAME):
|
||||
if not isfile(REPOSITORY_TOKEN_FILENAME):
|
||||
raise GitFlowError(
|
||||
"No existe un token para el repositorio en " + REPOSITORY_TOKEN_FILENAME
|
||||
)
|
||||
@@ -153,6 +157,23 @@ class Command(ABC):
|
||||
with open(REPOSITORY_TOKEN_FILENAME) as f:
|
||||
return f.readline().strip()
|
||||
|
||||
def ensure_clean_worktree(self, has_remote: bool):
|
||||
status = Git.status()
|
||||
|
||||
if not status:
|
||||
return
|
||||
|
||||
not_empty = any(map(lambda s: s.index != " " or s.worktree != " ", status))
|
||||
|
||||
if not_empty:
|
||||
if not has_remote:
|
||||
self.warning("Existen cambios en tu entorno de trabajo sin commitear.")
|
||||
else:
|
||||
raise GitFlowError("No se puede continuar con cambios pendientes.")
|
||||
|
||||
if not self.confirm("¿Desea continuar?", False):
|
||||
raise GitFlowError("Ejecución abortada")
|
||||
|
||||
def get_branch_env_and_type(self, branch: str) -> tuple[str, str]:
|
||||
components = branch.split("/")
|
||||
target_branches = self.flowconfig["flow.branches"].split(" ")
|
||||
|
||||
Reference in New Issue
Block a user