Release notes tools: Improve grammar in list of backported commits

This commit improves the grammar when reporting which versions of
Blender a commit was backported to in the "bug fixes per major release"
script if it was backported to 3 or more verisons of Blender.

Before:
- Backported to 3.6.22 & 4.2.9 & 4.4.1

After:
- Backported to 3.6.22, 4.2.9, and 4.4.1

Along with this change, I now use the word "and" rather than the
symbol "&".

Pull Request: https://projects.blender.org/blender/blender/pulls/138500
This commit is contained in:
Alaska
2025-05-09 15:52:43 +02:00
committed by Alaska
parent d3c0cf87cb
commit ba38a2257e

View File

@@ -426,8 +426,15 @@ class CommitInfo:
formatted_string = (
f" * {title} [[{self.hash[:11]}](https://projects.blender.org/blender/blender/commit/{self.hash})]"
)
if len(self.backport_list) > 0:
formatted_string += f" - Backported to {' & '.join(self.backport_list)}"
formatted_string += f" - Backported to "
if len(self.backport_list) > 2:
# In case of three or more backports, create a list that looks like:
# "Backported to 3.6, 4.2, and 4.3"
formatted_string += f"{', '.join(self.backport_list[:-1])}, and {self.backport_list[-1]}"
else:
formatted_string += " and ".join(self.backport_list)
formatted_string += "\n"
return formatted_string