chore(torrserv_proxy): revert push_branch_template, use auto-{version}

Per Alex's feedback: the original push logic in CheckoutMerged that
auto-generates a branch named 'auto-{version}' from the merged commit
hashes is the convention we keep. Drop the push_branch_template knob
and the matching push_branch field on CheckoutAndMergeResult that
were introduced in the previous commit, so downstream steps get the
standard remote_branch_name back instead.

GitHubActionTrigger uses the merge commit_hash directly (commit_hash
field on CheckoutAndMergeResult, which is unaffected) for the
workflow ref, so we don't need a dedicated push_branch field.
This commit is contained in:
2026-08-31 18:18:07 +00:00
parent c46e4015ec
commit d9823d0abc
2 changed files with 3 additions and 19 deletions
-2
View File
@@ -19,8 +19,6 @@ state = SharedStateHolderInMemory(unmerge=unmerge)
checkoutMerged = CheckoutMerged(clone,
desired_branches=state,
push=True,
push_branch_template="auto-deploy/torrserv_proxy/{commit_sha}",
git_user_email="rudolfss13@gmail.com",
git_user_name="brencher_bot"
)
+3 -17
View File
@@ -149,7 +149,6 @@ class CheckoutAndMergeResult:
remote_branch_name: str | None
commit_hash: str
version: str
push_branch: str | None = None
def _commits_childs(repo: git.Repo) -> Dict[Commit, List[Commit]]:
@@ -185,7 +184,6 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
git_user_email: str,
git_user_name: str,
push: bool = True,
push_branch_template: str | None = None,
**kwargs: Any):
super().__init__(**kwargs)
self.wd = wd
@@ -193,7 +191,6 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
self.git_user_email = git_user_email
self.git_user_name = git_user_name
self.push = push
self.push_branch_template = push_branch_template
def _find_merge_childs(self, tree: Dict[Commit, List[Commit]], commit: Commit) -> List[Commit]:
@@ -310,29 +307,18 @@ class CheckoutMerged(AbstractStep[CheckoutAndMergeResult]):
remote_branch_name = branch_name if remote_name == 'origin' else ref.name
break
if self.push and remote_branch_name is None:
if self.push_branch_template:
auto_branch_name = self.push_branch_template.format(
commit_sha=repo.head.commit.hexsha,
commit_sha_short=repo.head.commit.hexsha[:8],
version=version,
)
else:
auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest()
auto_branch_name = f"auto-{version}"
auto_branch_hash = hashlib.sha1(''.join([x.hexsha for x in sorted_commits]).encode()).hexdigest()
auto_branch_name = f"auto-{version}"
logger.info(f"Pushing {repo.head.commit.hexsha} -> {auto_branch_name}")
repo.git.push('-f', 'origin', f"HEAD:refs/heads/{auto_branch_name}")
remote_branch_name = auto_branch_name
push_branch = auto_branch_name
else:
push_branch = None
return CheckoutAndMergeResult(
wd=repo_path,
remote_branch_name=remote_branch_name,
commit_hash=repo.head.commit.hexsha,
version=version,
push_branch=push_branch,
version=version
)