Compare commits

...
9 Commits
Author SHA1 Message Date
gitea-actions 889109bf77 chore: bump version and update CHANGELOG.md [skip ci] 2026-09-18 14:27:33 +00:00
jt 164eded8f8 Merge pull request 'bugfix: muevo titulo de error al panel, agrego repositorio a gitlab error' (#23) from bugfix/add-debug-error-info-2 into main
Publish to PyPI / Publish-to-PyPI (push) Successful in 18s
Reviewed-on: #23
2026-09-18 14:27:19 +00:00
Jonathan Teran ce1ab99ddc bugfix: muevo titulo de error al panel, agrego repositorio a gitlab error 2026-09-18 11:26:55 -03:00
gitea-actions 8f96cb21f6 chore: bump version and update CHANGELOG.md [skip ci] 2026-09-18 13:27:25 +00:00
jt 9fa7fa41bd Merge pull request 'bugfix: agrego informacion de traceback para errores de GitFlow' (#22) from bugfix/add-debug-error-info into main
Publish to PyPI / Publish-to-PyPI (push) Successful in 38s
Reviewed-on: #22
2026-09-18 13:26:51 +00:00
Jonathan Teran 8a4cf6e667 bugfix: agrego informacion de traceback para errores de GitFlow 2026-09-18 10:25:52 -03:00
gitea-actions a502541e35 chore: bump version and update CHANGELOG.md [skip ci] 2026-09-17 14:52:53 +00:00
jt b6370648f9 Merge pull request 'bugfix: apply release prefix and ticket detection to single-commit PR titles' (#21) from bugfix/pr-title-single-commit into main
Publish to PyPI / Publish-to-PyPI (push) Successful in 19s
Reviewed-on: #21
2026-09-17 14:52:37 +00:00
Jonathan Teran e0200e3695 bugfix: apply release prefix and ticket detection to single-commit PR titles 2026-09-17 11:36:36 -03:00
4 changed files with 56 additions and 21 deletions
+21
View File
@@ -1,3 +1,24 @@
## v1.21.3 - 2026-09-18
- **bugfix**: muevo titulo de error al panel, agrego repositorio a gitlab error [[jteran](mailto:jteran@renatre.org.ar)] (ce1ab99)
---
## v1.21.2 - 2026-09-18
- **bugfix**: agrego informacion de traceback para errores de GitFlow [[jteran](mailto:jteran@renatre.org.ar)] (8a4cf6e)
---
## v1.21.1 - 2026-09-17
- **bugfix**: apply release prefix and ticket detection to single-commit PR titles [[jteran](mailto:jteran@renatre.org.ar)] (e0200e3)
---
## v1.21.0 - 2026-09-17 ## v1.21.0 - 2026-09-17
- **feature**: downgrade python version for better compatibility [[jteran](mailto:jteran@renatre.org.ar)] (55172bd) - **feature**: downgrade python version for better compatibility [[jteran](mailto:jteran@renatre.org.ar)] (55172bd)
+24 -14
View File
@@ -1,3 +1,5 @@
from typing import Optional
import typer import typer
import git_flow.command.base as base import git_flow.command.base as base
@@ -102,7 +104,7 @@ def check_merge_conflicts(target: str):
def create_pull_request(token: str, branch: str, target: str): def create_pull_request(token: str, branch: str, target: str):
changelog = Changelog() changelog = Changelog()
commits = Git("log", target + "..", format="%s").lines() commits = Git("log", target + "..", format="%s").lines()
title = commits[0] if len(commits) == 1 else _get_pr_title_from_branch(branch) title = _get_pr_title(branch, commits)
base.panel("Título del PR", title) base.panel("Título del PR", title)
@@ -120,34 +122,42 @@ def create_pull_request(token: str, branch: str, target: str):
base.io_success(message, "Rama creada") base.io_success(message, "Rama creada")
def _get_pr_title_from_branch(branch: str) -> str: def _get_pr_title(branch: str, commits: list[str]) -> str:
if branch in base.environments: if branch in base.environments:
target = base.environments[base.environments.index(branch) + 1] target = base.environments[base.environments.index(branch) + 1]
return f"Sincronización de entorno {branch} a {target}" return f"Sincronización de entorno {branch} a {target}"
components = branch.split("/") # <type>/<desc> or release/<env>/<type>/<desc> components = branch.split("/") # <type>/<desc> or release/<env>/<type>/<desc>
release_prefix = f"[Pasaje a {components[1]}]" if len(components) == 4 else None
branch_type = components[-2] branch_type = components[-2]
branch_desc = components[-1] branch_ticket, branch_desc = _extract_ticket_from_branch(components[-1])
# detect if branch description has ticket as prefix: <desc> = ABC-123-my-branch-name # when there's a single commit, use it as the PR description instead of
branch_ticket = None # deriving one from the branch name, but keep the release prefix / ticket
first_dash = branch_desc.find("-") if len(commits) == 1:
second_dash = branch_desc.find("-", first_dash + 1) return " ".join(filter(None, [release_prefix, branch_ticket, commits[0]]))
if first_dash >= 0 and second_dash >= 0:
maybe_ticket = branch_desc[:second_dash]
if base.is_valid_ticket(maybe_ticket):
branch_ticket = maybe_ticket
branch_desc = branch_desc[second_dash + 1 :]
return " ".join( return " ".join(
filter( filter(
None, None,
[ [
f"[Pasaje a {components[1]}]" if len(components) == 4 else None, release_prefix,
branch_type + ":", branch_type + ":",
branch_ticket, branch_ticket,
branch_desc.replace("-", " "), branch_desc.replace("-", " "),
], ],
) )
) )
def _extract_ticket_from_branch(branch_desc: str) -> tuple[Optional[str], str]:
"""detect if branch description has ticket as prefix: <desc> = ABC-123-my-branch-name"""
first_dash = branch_desc.find("-")
second_dash = branch_desc.find("-", first_dash + 1)
if first_dash >= 0 and second_dash >= 0:
maybe_ticket = branch_desc[:second_dash]
if base.is_valid_ticket(maybe_ticket):
return maybe_ticket, branch_desc[second_dash + 1 :]
return None, branch_desc
+10 -6
View File
@@ -1,10 +1,12 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import traceback
from subprocess import SubprocessError
import typer import typer
from git_flow import GitFlowError from git_flow import GitFlowError
import git_flow.command.base as base from git_flow.command import base, branch, commit, init, merge, new, release, tag
from git_flow.command import init, new, commit, merge, tag, release, branch
REPOSITORY_TOKEN_PATH = ".repository-token" REPOSITORY_TOKEN_PATH = ".repository-token"
LOCALE = "es_AR.UTF-8" LOCALE = "es_AR.UTF-8"
@@ -25,8 +27,10 @@ def main():
app() app()
print() print()
except GitFlowError as e: except GitFlowError as e:
base.io_error(str(e), title="Git Flow") lines = [str(e), ""]
except Exception as e: lines += traceback.format_exception(e)
base.io_error(str(e), title="Inesperado") base.io_error("".join(lines), title="Git Flow")
except KeyboardInterrupt as e: except SubprocessError as e:
base.io_error(str(e), title="Comando")
except KeyboardInterrupt:
base.io_error("Ejecución abortada") base.io_error("Ejecución abortada")
+1 -1
View File
@@ -45,7 +45,7 @@ class GitlabRemoteAPI(RemoteAPI):
if response.ok: if response.ok:
return "Tag creado exitosamente: " + tag return "Tag creado exitosamente: " + tag
else: else:
raise GitFlowError("Ocurrió un error al crear el tag: " + response.text) raise GitFlowError("Ocurrió un error al crear el tag para repositorio " + quote(self.repository, safe="") + ": " + response.text)
def get_endpoint(self, resource: str) -> str: def get_endpoint(self, resource: str) -> str:
project_id = quote(self.repository, safe="") project_id = quote(self.repository, safe="")