Answer prose round 1: 0 🔴, 3 🟡 (0 misread); name which round commits count, and plainer docstrings and README bullets

This commit is contained in:
2026-10-28 22:38:37 +01:00
parent 4c552e0e58
commit 2866b828bc
6 changed files with 29 additions and 16 deletions
+6 -6
View File
@@ -10,7 +10,7 @@ from utc_stamp import utc
# The plan, and the records tools append to: none of their lines are the chunk's work.
NOT_WORK = ("todo.md", HISTORY, RECORD)
# Each commit as its hash, commit and author times and parents, its short hash and title, then the files it changed; a merge's are those it changed against its first parent. git refuses a NUL byte in a commit message, so a title can't split a record.
# Each commit as its hash, commit and author times and parents, its short hash and title, then the files it changed; a merge's files are those it changed against its first parent. git refuses a NUL byte in a commit message, so a title can't split a record.
LOG = ("log", "--format=%x00%H %ct %at %P%x1f%h%x1f%s", "--name-only", "--diff-merges=first-parent")
# One commit's record in LOG's output, without the NUL that opens it.
LOG_RECORD = re.compile(r"([0-9a-f]+) ([0-9]+) ([0-9]+) ([0-9a-f ]*)\x1f([0-9a-f]+)\x1f(.*)", re.DOTALL)
@@ -32,7 +32,7 @@ class Commit:
@dataclasses.dataclass(frozen=True)
class Span:
"""A chunk on a default branch, as cut_branch cuts it. Its change runs from before, None for the branch's first chunk, to tip, its newest commit on the first-parent line. label names it as the reports do, landed says how it reached the branch, and merged is tip's commit time. titles are those of every commit it brought."""
"""A chunk on a default branch, as cut_branch cuts it. before is the commit its change starts from, None for the branch's oldest chunk; tip is its newest commit on the first-parent line. label names it as the reports do, landed says how it reached the branch, and merged is tip's commit time. titles are those of every commit it brought."""
before: str | None
tip: str
label: str
@@ -43,7 +43,7 @@ class Span:
@dataclasses.dataclass(frozen=True)
class BranchChunk(Span):
"""A chunk with shipped, each todo.md item its change removed, as scored before it, and fixed_by, the later chunks that fixed code it shipped, newest first."""
"""A Span with two more fields: shipped holds each todo.md item its change removed, as scored before the change; fixed_by names the later chunks that fixed code it shipped, newest first."""
shipped: tuple[Item, ...]
fixed_by: tuple[str, ...]
@@ -110,7 +110,7 @@ def chunk_log(line: list[Commit]) -> list[list[Commit]]:
def landing(run: list[Commit]) -> Landing:
"""How a chunk chunk_log cut reached the branch: by a merge commit, by a rebase that gave a commit a commit time other than its author time, or by commits never replayed."""
"""How a run that chunk_log cut reached the branch: by a merge commit, by a rebase that gave a commit a commit time other than its author time, or by commits never replayed."""
if len(run[0].parents) > 1:
return "merge"
return "rebase" if any(commit.committed != commit.authored for commit in run) else "push"
@@ -145,7 +145,7 @@ def shipped(before: str, after: str) -> list[Item]:
def plan_revisions(branch: Branch) -> list[str]:
"""The revisions whose todo.md shipped_by needs: the commit before and the tip of each chunk, but the branch's first, that brought a commit changing todo.md."""
"""The revisions whose todo.md shipped_by needs: for each chunk that brought a commit changing todo.md, other than the branch's oldest chunk, the commit before it and its tip."""
changed = sorted({branch.owner[commit.hash] for commit in branch.commits.values() if "todo.md" in commit.files})
revisions: dict[str, None] = {}
for index in changed:
@@ -156,7 +156,7 @@ def plan_revisions(branch: Branch) -> list[str]:
def shipped_by(branch: Branch, plans: dict[str, str]) -> list[tuple[Item, ...]]:
"""The items each of the branch's chunks shipped, in the order of its chunks, read from todo.md's text at each revision plan_revisions named, as plans holds it; none for a chunk with a revision plans lacks, which changed no plan."""
"""The items each of the branch's chunks shipped, in the order of its chunks. plans holds todo.md's text at each revision plan_revisions names. A chunk with a revision plans lacks changed no plan, so it shipped none."""
found: list[tuple[Item, ...]] = []
for chunk in branch.chunks:
if chunk.before is not None and chunk.before in plans and chunk.tip in plans: