Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f5e683a1da | ||
|
|
fb9b8b57f6 | ||
|
|
c47afffa14 | ||
|
|
341e6239b2 | ||
|
|
4fb00e786f | ||
|
|
2ad747111f | ||
|
|
5c3a3171fd | ||
|
|
50979e2c3d | ||
|
|
a670b90899 | ||
|
|
532a93e95e | ||
|
|
29757ccfb5 | ||
|
|
7f857fdd68 | ||
|
|
432885e107 | ||
|
|
a7ea4a6149 | ||
|
|
717708469a |
+8
-3
@@ -1,6 +1,11 @@
|
|||||||
|
# Bitbucket token
|
||||||
.repository-token
|
.repository-token
|
||||||
|
|
||||||
**/__pycache__/
|
# Virtual environment
|
||||||
build/
|
venv/
|
||||||
**/*.egg-info/
|
|
||||||
|
# Build folders and artifacts
|
||||||
dist/
|
dist/
|
||||||
|
build/
|
||||||
|
**/__pycache__/
|
||||||
|
**/*.egg-info/
|
||||||
|
|||||||
@@ -1,3 +1,42 @@
|
|||||||
|
## v1.6.0 - 2025-11-29
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- **feature**: agrego opcion para agrupar ramas release [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (c47afff)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## v1.5.2 - 2025-11-28
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- **bugfix**: arreglo split de ramas de flow.branches [[jteran](mailto:jteran@renatre.org.ar)] (2ad7471)
|
||||||
|
- **bugfix**: arreglo iteracion de items de flowconfig en set_config [[jteran](mailto:jteran@renatre.org.ar)] (5c3a317)
|
||||||
|
- **docs**: agrego venv a lista de carpetas ignoradas [[jteran](mailto:jteran@renatre.org.ar)] (50979e2)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## v1.5.1 - 2025-11-27
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- **refactor**: muevo constantes a modulo git_flow para centralizar uso [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (29757cc)
|
||||||
|
- **bugfix**: ignorar carpetas generadas en build de lsp [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (7f857fd)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
## v1.5.0 - 2025-11-27
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- **feature**: modifico formato de listado de ramas [[jonathan.nerat](mailto:jonathan.nerat@gmail.com)] (7177084)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
## v1.4.0 - 2025-11-23
|
## v1.4.0 - 2025-11-23
|
||||||
|
|
||||||
### Commits
|
### Commits
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"exclude": [
|
||||||
|
"build",
|
||||||
|
"**/*.egg-info"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ COMMIT_TYPES = [
|
|||||||
"docs",
|
"docs",
|
||||||
"style",
|
"style",
|
||||||
"test",
|
"test",
|
||||||
"wip"
|
"wip",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Commits con estos valores incrementan el componente correspondiente
|
# Commits con estos valores incrementan el componente correspondiente
|
||||||
@@ -46,3 +46,15 @@ SUPPORTED_REMOTE_APIS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
REPOSITORY_TOKEN_FILENAME = ".repository-token"
|
REPOSITORY_TOKEN_FILENAME = ".repository-token"
|
||||||
|
|
||||||
|
COLOR_BLACK = "\033[30m"
|
||||||
|
COLOR_RED = "\033[31m"
|
||||||
|
COLOR_GREEN = "\033[32m"
|
||||||
|
COLOR_YELLOW = "\033[33m"
|
||||||
|
COLOR_BLUE = "\033[34m"
|
||||||
|
COLOR_5 = "\033[35m"
|
||||||
|
COLOR_6 = "\033[36m"
|
||||||
|
COLOR_7 = "\033[37m"
|
||||||
|
COLOR_BLACK_BOLD = "\033[1;30m"
|
||||||
|
COLOR_WHITE_BOLD = "\033[1;37m"
|
||||||
|
COLOR_RESET = "\033[0m"
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ from os.path import isfile
|
|||||||
|
|
||||||
from git_flow import (
|
from git_flow import (
|
||||||
BRANCH_TYPES,
|
BRANCH_TYPES,
|
||||||
|
COLOR_BLUE,
|
||||||
|
COLOR_GREEN,
|
||||||
|
COLOR_RED,
|
||||||
|
COLOR_RESET,
|
||||||
|
COLOR_YELLOW,
|
||||||
REPOSITORY_TOKEN_FILENAME,
|
REPOSITORY_TOKEN_FILENAME,
|
||||||
GitFlowError,
|
GitFlowError,
|
||||||
)
|
)
|
||||||
@@ -12,17 +17,6 @@ from git_flow.remote.base import RemoteAPI
|
|||||||
from git_flow.remote.bitbucket import BitbucketRemoteAPI
|
from git_flow.remote.bitbucket import BitbucketRemoteAPI
|
||||||
from git_flow.remote.github import GithubRemoteAPI
|
from git_flow.remote.github import GithubRemoteAPI
|
||||||
|
|
||||||
COLOR_BLACK = "\033[30m"
|
|
||||||
COLOR_RED = "\033[31m"
|
|
||||||
COLOR_GREEN = "\033[32m"
|
|
||||||
COLOR_YELLOW = "\033[33m"
|
|
||||||
COLOR_BLUE = "\033[34m"
|
|
||||||
COLOR_5 = "\033[35m"
|
|
||||||
COLOR_6 = "\033[36m"
|
|
||||||
COLOR_7 = "\033[37m"
|
|
||||||
COLOR_BLACK_BOLD = "\033[1;30m"
|
|
||||||
COLOR_RESET = "\033[0m"
|
|
||||||
|
|
||||||
TYPE_SUCCESS = 0
|
TYPE_SUCCESS = 0
|
||||||
TYPE_WARNING = 1
|
TYPE_WARNING = 1
|
||||||
TYPE_ERROR = 2
|
TYPE_ERROR = 2
|
||||||
@@ -176,7 +170,7 @@ class Command(ABC):
|
|||||||
|
|
||||||
def get_branch_env_and_type(self, branch: str) -> tuple[str, str]:
|
def get_branch_env_and_type(self, branch: str) -> tuple[str, str]:
|
||||||
components = branch.split("/")
|
components = branch.split("/")
|
||||||
target_branches = self.flowconfig["flow.branches"].split(" ")
|
target_branches = self.flowconfig["flow.branches"].split(",")
|
||||||
|
|
||||||
if len(components) == 2:
|
if len(components) == 2:
|
||||||
if components[0] not in BRANCH_TYPES:
|
if components[0] not in BRANCH_TYPES:
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
from git_flow import GitFlowError
|
from git_flow import COLOR_WHITE_BOLD, COLOR_GREEN, COLOR_RED, COLOR_RESET, GitFlowError
|
||||||
from git_flow.command.base import COLOR_GREEN, COLOR_RED, COLOR_RESET, Command
|
from git_flow.command.base import Command
|
||||||
from git_flow.git import Git
|
from git_flow.git import Git
|
||||||
|
|
||||||
|
|
||||||
@@ -30,17 +30,23 @@ class BranchCommand(Command):
|
|||||||
self.environments = self.flowconfig["flow.branches"].split(",")
|
self.environments = self.flowconfig["flow.branches"].split(",")
|
||||||
|
|
||||||
if args.environment is None:
|
if args.environment is None:
|
||||||
|
self.show_envs()
|
||||||
self.show_all_branches()
|
self.show_all_branches()
|
||||||
|
elif args.environment in self.environments:
|
||||||
|
self.show_envs()
|
||||||
|
self.show_env_branches(args.environment)
|
||||||
elif args.environment == "trash":
|
elif args.environment == "trash":
|
||||||
self.show_trash_branches()
|
self.show_trash_branches()
|
||||||
elif args.environment in self.environments:
|
|
||||||
self.show_env_branches(args.environment)
|
|
||||||
else:
|
else:
|
||||||
raise GitFlowError(f"'{args.environment}' no es un entorno válido.")
|
raise GitFlowError(f"'{args.environment}' no es un entorno válido.")
|
||||||
|
|
||||||
def show_trash_branches(self):
|
def show_trash_branches(self):
|
||||||
branches = self.get_trash_branches()
|
branches = self.get_trash_branches()
|
||||||
|
|
||||||
|
if not branches:
|
||||||
|
print("No hay ramas a mostrar.")
|
||||||
|
return
|
||||||
|
|
||||||
for branch in branches:
|
for branch in branches:
|
||||||
prefix = (COLOR_RED + "*") if branch == self.current_branch else " "
|
prefix = (COLOR_RED + "*") if branch == self.current_branch else " "
|
||||||
print(prefix + " " + branch + COLOR_RESET)
|
print(prefix + " " + branch + COLOR_RESET)
|
||||||
@@ -50,30 +56,34 @@ class BranchCommand(Command):
|
|||||||
|
|
||||||
def show_all_branches(self):
|
def show_all_branches(self):
|
||||||
for environment in self.environments:
|
for environment in self.environments:
|
||||||
self.show_env_branches(environment)
|
self.show_env_branches(environment, len(self.environments) > 1)
|
||||||
|
|
||||||
trash = len(self.get_trash_branches())
|
trash = len(self.get_trash_branches())
|
||||||
print("\nTrash: " + str(trash) + " rama" + ("" if trash == 1 else "s"))
|
|
||||||
|
|
||||||
def show_env_branches(self, environment: str):
|
if trash:
|
||||||
|
print()
|
||||||
|
print(COLOR_WHITE_BOLD + "Papelera: " + COLOR_RESET + str(trash) + " rama" + ("" if trash == 1 else "s"))
|
||||||
|
|
||||||
|
def show_envs(self):
|
||||||
|
print(COLOR_WHITE_BOLD + "Entornos" + COLOR_RESET)
|
||||||
|
for environment in self.environments:
|
||||||
|
prefix = (COLOR_GREEN + "*") if environment == self.current_branch else " "
|
||||||
|
print(prefix + " " + environment + COLOR_RESET)
|
||||||
|
print()
|
||||||
|
|
||||||
|
def show_env_branches(self, environment: str, show_env: bool = False):
|
||||||
is_first_env = environment == self.environments[0]
|
is_first_env = environment == self.environments[0]
|
||||||
branches = (
|
pattern = "refs/heads/" if is_first_env else "refs/heads/release/" + environment + "/"
|
||||||
Git(
|
pattern += "*/*"
|
||||||
"for-each-ref",
|
exclude = ["refs/heads/trash/", "refs/heads/release/"] if is_first_env else []
|
||||||
"refs/heads/",
|
branches = Git("for-each-ref", pattern, exclude=exclude, format=BRANCH_FORMAT).lines()
|
||||||
exclude=["refs/heads/trash/", "refs/heads/release/"],
|
|
||||||
format=BRANCH_FORMAT,
|
print(COLOR_WHITE_BOLD + (environment if show_env else "Ramas") + COLOR_RESET)
|
||||||
).lines()
|
|
||||||
if is_first_env
|
if not branches:
|
||||||
else Git(
|
print("No hay ramas a mostrar.")
|
||||||
"for-each-ref",
|
return
|
||||||
"refs/heads/release/" + environment + "/",
|
|
||||||
format=BRANCH_FORMAT,
|
|
||||||
).lines()
|
|
||||||
)
|
|
||||||
|
|
||||||
for branch in branches:
|
for branch in branches:
|
||||||
prefix = (COLOR_GREEN + "*") if branch == self.current_branch else " "
|
prefix = (COLOR_GREEN + "*") if branch == self.current_branch else " "
|
||||||
print(prefix + " " + branch + COLOR_RESET)
|
print(prefix + " " + branch + COLOR_RESET)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
import os
|
|
||||||
from git_flow import GitFlowError
|
from git_flow import GitFlowError
|
||||||
from git_flow.command.base import Command
|
from git_flow.command.base import Command
|
||||||
from git_flow.git import FLOWCONFIG_FILE, Git
|
from git_flow.git import FLOWCONFIG_FILE, Git
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from argparse import Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
from git_flow import COMMIT_TYPES, GitFlowError
|
from git_flow import COMMIT_TYPES, GitFlowError
|
||||||
from git_flow.command.base import Command
|
from git_flow.command.base import Command
|
||||||
from git_flow.git import Git
|
from git_flow.git import Git
|
||||||
@@ -11,6 +11,15 @@ class ReleaseCommand(Command):
|
|||||||
def description(self) -> str:
|
def description(self) -> str:
|
||||||
return """Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
return """Realiza el merge de la rama, o crea el PR para hacerlo si tiene un remoto configurado"""
|
||||||
|
|
||||||
|
def setup_parser(self, parser: ArgumentParser) -> ArgumentParser:
|
||||||
|
parser.add_argument(
|
||||||
|
"--group",
|
||||||
|
nargs="?",
|
||||||
|
help="Agrupar release",
|
||||||
|
)
|
||||||
|
|
||||||
|
return parser
|
||||||
|
|
||||||
def run(self, args: Namespace = Namespace()):
|
def run(self, args: Namespace = Namespace()):
|
||||||
self.ensure_initialized()
|
self.ensure_initialized()
|
||||||
|
|
||||||
@@ -34,10 +43,16 @@ class ReleaseCommand(Command):
|
|||||||
else f"release/{next_env}/{branch}"
|
else f"release/{next_env}/{branch}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
group = args.group
|
||||||
|
|
||||||
|
if not group and self.confirm("¿Desea agrupar este release con otra rama?"):
|
||||||
|
group = self.choice("Grupo release: ", Git.get_branches("release/" + next_env + "/"))
|
||||||
|
else:
|
||||||
|
group = next_env
|
||||||
|
|
||||||
if has_remote:
|
if has_remote:
|
||||||
Git("pull").exec(print="Sincronizando cambios de la rama")
|
Git("switch", group).exec(print="Cambiando a la rama objetivo")
|
||||||
Git("switch", next_env).exec(print="Cambiando al siguiente entorno")
|
Git("pull").exec(print="Sincronizando cambios la rama objetivo")
|
||||||
Git("pull").exec(print="Sincronizando cambios del entorno")
|
|
||||||
Git("switch", "-").exec(print="Volviendo a la rama original")
|
Git("switch", "-").exec(print="Volviendo a la rama original")
|
||||||
|
|
||||||
base = Git.get_first_fork_point(branch, env)
|
base = Git.get_first_fork_point(branch, env)
|
||||||
@@ -62,6 +77,6 @@ class ReleaseCommand(Command):
|
|||||||
else:
|
else:
|
||||||
Git("switch", next_branch, create=True).exec(print="Creando rama release")
|
Git("switch", next_branch, create=True).exec(print="Creando rama release")
|
||||||
|
|
||||||
Git("rebase", base, next_branch, onto=next_env).exec(
|
Git("rebase", base, next_branch, onto=group).exec(
|
||||||
print="Moviendo cambios hacia el siguiente ambiente"
|
print="Moviendo cambios hacia el siguiente ambiente"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class TagCommand(Command):
|
|||||||
def get_token_and_ci(self, args: Namespace):
|
def get_token_and_ci(self, args: Namespace):
|
||||||
try:
|
try:
|
||||||
return (self.ensure_repository_token(), False)
|
return (self.ensure_repository_token(), False)
|
||||||
except GitFlowError as e:
|
except GitFlowError:
|
||||||
return (args.token, True)
|
return (args.token, True)
|
||||||
|
|
||||||
def setup_parser(self, parser: ArgumentParser) -> ArgumentParser:
|
def setup_parser(self, parser: ArgumentParser) -> ArgumentParser:
|
||||||
|
|||||||
+4
-4
@@ -38,7 +38,7 @@ class Git:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def set_config(config: dict[str, str], file: str | None = None):
|
def set_config(config: dict[str, str], file: str | None = None):
|
||||||
for key, value in config:
|
for key, value in config.items():
|
||||||
Git("config", key, value, file=file).exec()
|
Git("config", key, value, file=file).exec()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -50,8 +50,8 @@ class Git:
|
|||||||
return Git("rev-parse", "HEAD", abbrev_ref=True).firstline()
|
return Git("rev-parse", "HEAD", abbrev_ref=True).firstline()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_branches():
|
def get_branches(prefix: str = ""):
|
||||||
return Git._get_references("heads")
|
return Git._get_references("heads/" + prefix)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def status():
|
def status():
|
||||||
@@ -79,7 +79,7 @@ class Git:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_references(kind: str):
|
def _get_references(kind: str):
|
||||||
prefix = "refs/" + kind + "/"
|
prefix = "refs/" + kind
|
||||||
return list(map(
|
return list(map(
|
||||||
lambda r: r.removeprefix(prefix),
|
lambda r: r.removeprefix(prefix),
|
||||||
Git("for-each-ref", prefix + "*", format="%(refname)").lines(),
|
Git("for-each-ref", prefix + "*", format="%(refname)").lines(),
|
||||||
|
|||||||
+1
-9
@@ -1,14 +1,6 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from git_flow import COLOR_BLACK_BOLD, COLOR_BLUE, COLOR_GREEN, COLOR_RED, COLOR_RESET, COLOR_YELLOW
|
||||||
COLOR_BLACK = '\033[30m'
|
|
||||||
COLOR_RED = '\033[31m'
|
|
||||||
COLOR_GREEN = '\033[32m'
|
|
||||||
COLOR_YELLOW = '\033[33m'
|
|
||||||
COLOR_BLUE = '\033[34m'
|
|
||||||
COLOR_BLACK_BOLD = '\033[1;30m'
|
|
||||||
COLOR_RESET = '\033[0m'
|
|
||||||
|
|
||||||
|
|
||||||
def confirm(prompt, default: bool = True):
|
def confirm(prompt, default: bool = True):
|
||||||
user_input = input(prompt + (" [Y/n]: " if default else " [y/N]: "))
|
user_input = input(prompt + (" [Y/n]: " if default else " [y/N]: "))
|
||||||
|
|||||||
Reference in New Issue
Block a user