From 8fe906e19fd970c9c9071822362b17c055ec7518 Mon Sep 17 00:00:00 2001 From: John Davis Date: Tue, 20 Feb 2024 09:23:47 -0500 Subject: [PATCH] Skip first release entry From suggested edit by @mvdbeek --- galaxy_release_util/point_release.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/galaxy_release_util/point_release.py b/galaxy_release_util/point_release.py index 2eac35d..8df823b 100644 --- a/galaxy_release_util/point_release.py +++ b/galaxy_release_util/point_release.py @@ -137,6 +137,11 @@ def read_package(package_path: pathlib.Path) -> Package: def parse_changelog(package: Package) -> List[ChangelogItem]: + + def append_change(changes, child): + if (rawsource := child.rawsource.strip()) and not rawsource.startswith("First release"): + changes.append(f"* {rawsource}") + settings = frontend.get_default_settings(Parser) # type: ignore[attr-defined] ## upstream type stubs not updated? document = utils.new_document(str(package.history_rst), settings) Parser().parse(package.history_rst.read_text(), document) @@ -164,7 +169,7 @@ def parse_changelog(package: Package) -> List[ChangelogItem]: # could be bullet list or a nested section with bugfix, docs, etc if changelog_item.tagname == "bullet_list": for child in changelog_item.children: - changes.append(f"* {child.rawsource.strip()}") + append_change(changes, child) elif changelog_item.tagname == "paragraph": changes = changelog_item.rawsource.splitlines() elif changelog_item.tagname == "section": @@ -173,7 +178,7 @@ def parse_changelog(package: Package) -> List[ChangelogItem]: changes.append(f"\n{section_delimiter}\n{kind}\n{section_delimiter}\n") for section_changelog_item in changelog_item[1:]: for child in section_changelog_item: - changes.append(f"* {child.rawsource.strip()}") + append_change(changes, child) changelog_items.append(ChangelogItem(version=current_version, date=current_date, changes=changes)) # Filter out dev release versions without changelog,