spork-create: check for conflicting branch names before sporking

Bail if upstream already has branches named 'blumeops' or 'deploy',
which would conflict with the spork branch naming strategy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erich Blume 2026-03-29 09:36:53 -07:00
commit 9115044219

View file

@ -272,6 +272,21 @@ def main(
) )
raise SystemExit(1) raise SystemExit(1)
# Verify upstream doesn't have branches that conflict with spork names
for reserved in ("blumeops", "deploy"):
resp = forge_api(
client,
"GET",
f"/repos/{MIRROR_ORG}/{repo_name}/branches/{reserved}",
token,
)
if resp.status_code == 200:
console.print(
f"[red]Error:[/red] Upstream already has a branch named "
f"[bold]{reserved}[/bold] — this conflicts with the spork strategy."
)
raise SystemExit(1)
console.print(f" Mirror: {MIRROR_ORG}/{repo_name}") console.print(f" Mirror: {MIRROR_ORG}/{repo_name}")
console.print(f" Upstream: {upstream_url}") console.print(f" Upstream: {upstream_url}")
console.print(f" Main branch: {detected_main}") console.print(f" Main branch: {detected_main}")