Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
432885e107 | ||
|
|
a7ea4a6149 | ||
|
|
717708469a |
@@ -1,3 +1,12 @@
|
|||||||
|
## 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
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ COLOR_5 = "\033[35m"
|
|||||||
COLOR_6 = "\033[36m"
|
COLOR_6 = "\033[36m"
|
||||||
COLOR_7 = "\033[37m"
|
COLOR_7 = "\033[37m"
|
||||||
COLOR_BLACK_BOLD = "\033[1;30m"
|
COLOR_BLACK_BOLD = "\033[1;30m"
|
||||||
|
COLOR_WHITE_BOLD = "\033[1;37m"
|
||||||
COLOR_RESET = "\033[0m"
|
COLOR_RESET = "\033[0m"
|
||||||
|
|
||||||
TYPE_SUCCESS = 0
|
TYPE_SUCCESS = 0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from argparse import ArgumentParser, Namespace
|
from argparse import ArgumentParser, Namespace
|
||||||
from git_flow import GitFlowError
|
from git_flow import GitFlowError
|
||||||
from git_flow.command.base import COLOR_GREEN, COLOR_RED, COLOR_RESET, Command
|
from git_flow.command.base import COLOR_GREEN, COLOR_RED, COLOR_RESET, COLOR_WHITE_BOLD, 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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user