Merged in bugfix/first-fork-point-getter (pull request #46)

bugfix: first fork point getter

Approved-by: Jonathan Teran
This commit is contained in:
JonathanGitFlow
2025-12-11 18:17:53 +00:00
committed by jt
+4 -10
View File
@@ -63,19 +63,13 @@ class Git:
@staticmethod
def get_first_fork_point(branch: str, env: str):
boundary_commits = list(
filter(
lambda c: c.startswith("-"), # boundary commits
Git(
"rev-list", env + "..." + branch, topo_order=True, boundary=True
).lines(),
)
)
# Lista de commits alcanzables por el entorno (por ejemplo, dev),
env_commits = Git("rev-list", env + "..." + branch, first_parent=True).lines()
if not boundary_commits:
if not env_commits:
raise RuntimeError("No se encontro un commit base para realizar el rebase.")
return boundary_commits[-1].removeprefix("-")
return Git("show", env_commits[-1] + "^", patch=False, format="%h").firstline()
@staticmethod
def _get_references(kind: str):