Keep configs in ~/.config/build-release/ and tool state in ~/.local/state/build-release/, under XDG_* where set
CI / tests (pull_request) Successful in 6m34s
CI / tests (pull_request) Successful in 6m34s
This commit is contained in:
@@ -63,12 +63,12 @@ class ArchiveChunks:
|
||||
unread: tuple[str, ...] = ()
|
||||
|
||||
|
||||
def measure_archive(root: pathlib.Path, home: str, since: str, git: Git) -> ArchiveChunks | Failure:
|
||||
def measure_archive(root: pathlib.Path, home: str, env: typing.Mapping[str, str], since: str, git: Git) -> ArchiveChunks | Failure:
|
||||
"""The figures of each chunk that finished after since, measured one chunk at a time because the archive outgrows memory. Only an archive that cannot be listed fails."""
|
||||
listed = archived_outcomes(root)
|
||||
if isinstance(listed, Failure):
|
||||
return listed
|
||||
projects = [measure_project(root, project, home, since, git) for project in sorted({root / key for key, _ in listed})]
|
||||
projects = [measure_project(root, project, home, env, since, git) for project in sorted({root / key for key, _ in listed})]
|
||||
return ArchiveChunks(
|
||||
[chunk for project in projects for chunk in project.chunks],
|
||||
tuple(skipped for project in projects for skipped in project.skipped),
|
||||
@@ -76,7 +76,7 @@ def measure_archive(root: pathlib.Path, home: str, since: str, git: Git) -> Arch
|
||||
)
|
||||
|
||||
|
||||
def measure_project(root: pathlib.Path, project: pathlib.Path, home: str, since: str, git: Git) -> ArchiveChunks:
|
||||
def measure_project(root: pathlib.Path, project: pathlib.Path, home: str, env: typing.Mapping[str, str], since: str, git: Git) -> ArchiveChunks:
|
||||
"""The figures of each of one project's chunks that finished after since, as measure_archive measures them."""
|
||||
key = str(project.relative_to(root))
|
||||
listed = finished_chunks(project)
|
||||
@@ -86,11 +86,11 @@ def measure_project(root: pathlib.Path, project: pathlib.Path, home: str, since:
|
||||
if not chunks:
|
||||
return ArchiveChunks([], ())
|
||||
checkout = checkout_of(key, pathlib.Path(home))
|
||||
titles = title_templates(checkout, pathlib.Path(home), functools.partial(git, timeout=GIT_TIMEOUT, guarded=True))
|
||||
titles = title_templates(checkout, pathlib.Path(home), env, functools.partial(git, timeout=GIT_TIMEOUT, guarded=True))
|
||||
if isinstance(titles, Failure):
|
||||
# Read bare, a templated project's round titles would count as no round.
|
||||
return ArchiveChunks([], (), (f"{key}: none of its chunks is measured: {titles.reason}",))
|
||||
history = branch_history(checkout, pathlib.Path(home), titles, git)
|
||||
history = branch_history(checkout, pathlib.Path(home), env, titles, git)
|
||||
found = []
|
||||
skipped = []
|
||||
for chunk in chunks:
|
||||
@@ -106,10 +106,10 @@ def measure_project(root: pathlib.Path, project: pathlib.Path, home: str, since:
|
||||
return ArchiveChunks(found, tuple(skipped), (f"{key}: {history.reason}",) if isinstance(history, Failure) else ())
|
||||
|
||||
|
||||
def branch_history(checkout: str, home: pathlib.Path, titles: Titles, git: Git) -> list[BranchChunk] | Failure:
|
||||
def branch_history(checkout: str, home: pathlib.Path, env: typing.Mapping[str, str], titles: Titles, git: Git) -> list[BranchChunk] | Failure:
|
||||
"""The chunks on the checkout's default branch as last fetched, each title read through titles, the project's title templates; read guarded, since the checkout's config may name a program. A Failure where the project's config under home puts the plan or a record where branch_chunks reads no commits."""
|
||||
guarded = functools.partial(git, cwd=checkout, timeout=GIT_TIMEOUT, guarded=True)
|
||||
if why := unsupported(checkout, home, guarded):
|
||||
if why := unsupported(checkout, home, env, guarded):
|
||||
return Failure(f"its chunks' items and later fixes are not counted: {why}")
|
||||
ref = default_ref(checkout, GIT_TIMEOUT, guarded=True, run=git)
|
||||
return ref if isinstance(ref, Failure) else branch_chunks(ref, guarded, titles)
|
||||
|
||||
Reference in New Issue
Block a user