feat: follow the branch a port was read from

This commit is contained in:
Abdessamad Derraz committed 2026-08-10 17:55:35 +02:00
1 parent 87087c74f0
commit 2b7c5f9a64
5 files changed
+503 -124

No files matched your search

+6 -1
View File
@@ -687,6 +687,9 @@ def select_views(
"""
views: list[RepoView] = []
seen: set[tuple[str, str]] = set()
# A port living on a branch of a fork is absent from the default tip, so
# the branch it was read from is followed when the profile names one.
branch = str(profile.get("source_branch") or "") or None
for field in ("source", "upstream"):
repo = upstream.parse_repo(str(profile.get(field) or ""))
if repo is None or (repo.host, repo.slug) in seen:
@@ -694,7 +697,9 @@ def select_views(
pin, origin = resolve_pin(profile, repo, cache_dir, offline, field)
if not pin:
continue
head = upstream.resolve_head(repo, cache_dir, offline)
head = upstream.resolve_head(
repo, cache_dir, offline, branch if field == "source" else None
)
if not head:
continue
seen.add((repo.host, repo.slug))