Release note tool: Sort backport version numbers from lowest to highest

This commit adds a feature to the bug fixes per release tool to ensure
the version numbers of the backported Blender versions are in ascending
order.

Before: 4.2.9, 4.4.1, 4.2.9
After: 3.6.22, 4.2.9, 4.4.1

Pull Request: https://projects.blender.org/blender/blender/pulls/139011
This commit is contained in:
Alaska
2025-06-04 09:47:42 +02:00
committed by Philipp Oeser
parent 2c41ee58d1
commit 6e43896e86

View File

@@ -410,6 +410,12 @@ class CommitInfo:
break
def generate_release_note_ready_string(self) -> str:
def sort_version_numbers(input_version_num: str) -> str:
# Pad to three digits for future proofness
pad = 3
major, minor, patch = input_version_num.split(".")
return major.zfill(pad) + minor.zfill(pad) + patch.zfill(pad)
# Breakup report_title based on words, and remove `:` if it's at the end of the first word.
# This is because the website the release notes are being posted to applies some undesirable
# formatting to ` * Word:`.
@@ -426,6 +432,8 @@ class CommitInfo:
f" * {title} [[{self.hash[:11]}](https://projects.blender.org/blender/blender/commit/{self.hash})]"
)
self.backport_list.sort(key=sort_version_numbers)
if len(self.backport_list) > 0:
formatted_string += f" - Backported to "
if len(self.backport_list) > 2: