Test the environment git runs in, an unreadable digest and the history write of task-bench record-figures
CI / tests (pull_request) Successful in 5m28s
CI / tests (pull_request) Successful in 5m28s
This commit is contained in:
@@ -9,8 +9,10 @@ from task_bench.gather import DIGEST
|
||||
from failure import Failure
|
||||
from git_cli import git_repo
|
||||
from task_bench.bench_folder import held
|
||||
from record_store.held import Held
|
||||
from larv_review.history_commands import held_history
|
||||
from review_rules.review_folder import made_review_folder
|
||||
from record_store.stores import RecordStore
|
||||
from git_cli.git_repo import top
|
||||
from text_files.utc_stamp import utc
|
||||
|
||||
@@ -46,17 +48,17 @@ def record_figures(env: typing.Mapping[str, str], home: pathlib.Path, now: float
|
||||
entry = bench_entry(digest, branch.strip(), now)
|
||||
if entry is None:
|
||||
return Failure(f"{folder / DIGEST} is no task-bench digest: it lacks the line that names its base and head, or the table's three All rows")
|
||||
name, text = entry
|
||||
read = held_history(home)
|
||||
if isinstance(read, Failure):
|
||||
return read
|
||||
history, found = read
|
||||
if f", {name}\n" in found.text:
|
||||
return Failure(f"{history.label} already holds {name}; record each bench once")
|
||||
written = history.write(appended(found.text, text), found.version)
|
||||
return written if isinstance(written, Failure) else f"Appended to {history.label}."
|
||||
return read if isinstance(read, Failure) else appended_to(*read, *entry)
|
||||
|
||||
|
||||
def appended_to(history: RecordStore, held: Held, name: str, entry: str) -> str | Failure:
|
||||
"""Writes entry, of the bench the history calls name, onto held, the history as history's store read it, over held's version; the line the tool prints, or why the entry isn't written."""
|
||||
if f", {name}\n" in held.text:
|
||||
return Failure(f"{history.label} already holds {name}; record each bench once")
|
||||
written = history.write(appended(held.text, entry), held.version)
|
||||
return written if isinstance(written, Failure) else f"Appended to {history.label}."
|
||||
|
||||
def bench_entry(digest: str, branch: str, now: float) -> tuple[str, str] | None:
|
||||
"""What the history calls the bench of branch that digest tells of, and its entry, stamped with now: the table's header and its rows over every bug. None where digest is no task-bench digest."""
|
||||
sides = SIDES.search(digest)
|
||||
|
||||
Reference in New Issue
Block a user