MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / parse_changelog

Function parse_changelog

scripts/prepare-release.py:86–109  ·  view source on GitHub ↗

Split CHANGELOG into preface + ordered list of version blocks.

(text: str)

Source from the content-addressed store, hash-verified

84
85
86def parse_changelog(text: str):
87 """Split CHANGELOG into preface + ordered list of version blocks."""
88 lines = text.split("\n")
89 preface: list[str] = []
90 blocks: list[dict] = []
91 cur: dict | None = None
92 for line in lines:
93 m = VERSION_HEADER_RE.match(line)
94 if m:
95 if cur:
96 blocks.append(cur)
97 cur = {
98 "header": line,
99 "name": m.group(1),
100 "date": m.group(2),
101 "body": [],
102 }
103 elif cur is not None:
104 cur["body"].append(line)
105 else:
106 preface.append(line)
107 if cur:
108 blocks.append(cur)
109 return preface, blocks
110
111
112def join_changelog(preface: list[str], blocks: list[dict]) -> str:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected