feat: each citation names the code that asks

A profile that reads a libretro core and the original emulator cited both trees alike, and readers could not tell whether the core or the emulator asked for a file. A cited path now opens with source or upstream, the repository its lines are in. Emulator code a port carries is attributed upstream when the original holds the same value on the cited line.

profile_sync --attribute-refs writes the words from where the lines are found and follows a word already written. The site links each citation to that repository's pin, labels it libretro core or upstream emulator, and says on each file card whose code asks for it. A recale keeps the word, and mame_ref_audit reads the tree it names.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 05:52:13 +02:00
1 parent adea35e12a
commit dec0fdc163
9 files changed
+306 -21

No files matched your search

+16
View File
@@ -16,6 +16,22 @@ _ANNOTATION_RE = re.compile(r"\s*\([^)]*\)?")
_LOCATED_RE = re.compile(r"^[^\s:]+:\d+(?:-\d+)?$")
# A part opening with one of these words says which declared repository its
# lines are in: `upstream src/bios.c:40` is the original emulator,
# `source libretro.c:120` the repository the profile names as its source,
# usually the libretro port. A reader could not tell which code asked for
# the file when a profile declares both.
REPO_ROLES = ("source", "upstream")
def ref_role(path: str) -> tuple[str, str]:
"""The role word a cited path opens with, and the path without it."""
word, _, rest = path.partition(" ")
if word in REPO_ROLES and rest.strip():
return word, rest.strip()
return "", path
@dataclass(frozen=True)
class RefPart:
path: str