From ba38a2257e2f6dcfa9b75b9262f58df9febdba1a Mon Sep 17 00:00:00 2001 From: Alaska Date: Fri, 9 May 2025 15:52:43 +0200 Subject: [PATCH] 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 --- release/release_notes/bug_fixes_per_major_release.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/release/release_notes/bug_fixes_per_major_release.py b/release/release_notes/bug_fixes_per_major_release.py index 5ac30a5ba05..c01b9639a8f 100644 --- a/release/release_notes/bug_fixes_per_major_release.py +++ b/release/release_notes/bug_fixes_per_major_release.py @@ -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