Answer stability round 2: 0 🔴, 2 🟡; take the next release as the earliest todo.md has named since the last cut, so an emptied patch or a major jump stops the loop too, count work landed by the Unreleased entries before commits, read the default branch once, and test the emptied release and the stalled origin through real git
This commit is contained in:
@@ -4,7 +4,7 @@ import pathlib
|
||||
import re
|
||||
import typing
|
||||
|
||||
from todo_table import chunk_item, Item, item_details, items
|
||||
from todo_table import chunk_item, Item, item_details, items, LastCut
|
||||
from failure import Failure
|
||||
|
||||
# The CLI that lists a forge's pull requests: gh for a github.com origin, tea for any other.
|
||||
@@ -21,15 +21,6 @@ class Ran:
|
||||
stderr: str
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Release:
|
||||
"""What the last release fact rests on, each read from the default branch."""
|
||||
tag: str | None | Failure
|
||||
changelog: str | Failure
|
||||
# How many commits follow the tag, or make up the branch where it has none.
|
||||
commits: int | Failure
|
||||
|
||||
|
||||
@dataclasses.dataclass(frozen=True)
|
||||
class Plan:
|
||||
"""The default branch's todo.md items, and first, the item the next chunk takes first."""
|
||||
@@ -85,12 +76,12 @@ class Gathered:
|
||||
default: str
|
||||
# Why origin reads as last fetched; None after a fetch.
|
||||
note: str | None
|
||||
release: Release
|
||||
cut: LastCut
|
||||
# What was found or made for the plan's first item; else why the plan names none.
|
||||
item: ItemFacts | NoItem
|
||||
|
||||
|
||||
def planned(todo: str | Failure, release: Release, default: str) -> Plan | NoItem:
|
||||
def planned(todo: str | Failure, cut: LastCut, default: str) -> Plan | NoItem:
|
||||
"""The plan in todo, the default branch's todo.md, with the item the next chunk takes first, todo_table.chunk_item's pick, which routing makes too; else why there is none."""
|
||||
where = f"{default}'s todo.md"
|
||||
if isinstance(todo, Failure):
|
||||
@@ -101,16 +92,16 @@ def planned(todo: str | Failure, release: Release, default: str) -> Plan | NoIte
|
||||
if found is None:
|
||||
return NoItem(f"{where} holds no items table.")
|
||||
earliest = min((item.release for item in found), default=None)
|
||||
stands, first = chunk_item(found, release.tag, release.commits)
|
||||
stands, first = chunk_item(found, cut)
|
||||
if earliest is not None and stands == "cut":
|
||||
return NoItem(f"{where} files items under release {version(earliest)}, which is not after the last cut, {release.tag}.")
|
||||
gap = f"{where} holds no item for the release after the last cut, {release.tag}, and"
|
||||
return NoItem(f"{where} files items under release {version(earliest)}, which is not after the last cut, {cut.tag}.")
|
||||
gap = f"{where} holds no item for the next release after the last cut, {cut.tag}, and"
|
||||
if stands == "finished":
|
||||
return NoItem(f"{gap} commits have landed since, so that release is finished and ready to cut, and the working loop stops here.")
|
||||
return NoItem(f"{gap} work has landed since, so that release is finished and ready to cut, and the working loop stops here.")
|
||||
if stands == "unplanned":
|
||||
return NoItem(f"{gap} no commit has landed since, so that release is to be planned first.")
|
||||
return NoItem(f"{gap} no work has landed since, so that release is to be planned first.")
|
||||
if stands == "unknown":
|
||||
return NoItem(f"{gap} the commits since it cannot be counted.")
|
||||
return NoItem(f"{gap} the work landed since it cannot be counted.")
|
||||
if first is None:
|
||||
return NoItem(f"every item of release {version(earliest)} in {where} waits." if earliest is not None else f"{where}'s items table holds no item.")
|
||||
details = item_details(todo)
|
||||
|
||||
Reference in New Issue
Block a user