Write no changelog bullet for a plan kept in Jira: todo-item finish there needs no changelog flag and refuses --changelog
CI / tests (pull_request) Successful in 3m17s
CI / tests (pull_request) Successful in 3m17s
This commit is contained in:
@@ -63,7 +63,7 @@ mistake. It prints `Finished item <ID> in <plan>.` It doesn't write anything whi
|
||||
finish <ID> --no-changelog also drops an item no chunk built.
|
||||
In a Jira epic, finish doesn't remove anything: it moves the item's issue by the transition, and to
|
||||
the status, that the config's `jira-finish-transition` and `jira-finish-status` name, as
|
||||
`project-config --help` shows. The --changelog rules hold there too, and docs/decisions.md isn't checked.
|
||||
`project-config --help` shows. It needs neither --changelog nor --no-changelog (it accepts --no-changelog), never reads the changelog, and refuses --changelog, since the issues' history is the changelog. docs/decisions.md isn't checked.
|
||||
It fails, moving no issue, where the config sets neither, where the issue has no such transition
|
||||
from its present status, or where the transition leads to another status or to one Jira doesn't
|
||||
count as done. An issue that no chunk built is dropped in Jira, not with finish, which would mark it done.
|
||||
@@ -116,7 +116,8 @@ def main(argv: list[str], folder: pathlib.Path = pathlib.Path(), stdin: typing.T
|
||||
case "move":
|
||||
done = reported(plan.edit(args.id, {"Release": args.release}, None), "not moved", lambda written: f"Moved item {written.id} to release {args.release} in {plan.label}.")
|
||||
case _:
|
||||
done = finish(args, plan, store(config, "changelog"))
|
||||
# A Jira plan keeps no changelog: the issues' history in Jira says what shipped.
|
||||
done = finish(args, plan, None if config.epic else store(config, "changelog"))
|
||||
if isinstance(done, Failure):
|
||||
print(done.reason, file=sys.stderr)
|
||||
return 1
|
||||
@@ -217,7 +218,12 @@ def edit(args: argparse.Namespace, plan: PlanStore, text: str) -> str | Failure:
|
||||
return reported(plan.edit(args.id, fields(args), detail, args.comment), "not edited", lambda written: f"Edited item {written.id} in {plan.label}.")
|
||||
|
||||
|
||||
def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore) -> str | Failure:
|
||||
def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore | None) -> str | Failure:
|
||||
"""Finish item args.id in plan. changelog is where its bullet goes, or None where the plan keeps no changelog."""
|
||||
if changelog is None:
|
||||
if args.changelog is not None:
|
||||
return Failure("not finished: this plan keeps no changelog, since the issues' history is the changelog; drop --changelog")
|
||||
return reported(plan.finish(args.id), "not finished", lambda written: f"Finished item {written.id} in {plan.label}.")
|
||||
held = changelog.held()
|
||||
if isinstance(held, Failure):
|
||||
return Failure(f"not finished: {held.reason}")
|
||||
|
||||
Reference in New Issue
Block a user