Skip to content

Commit

Permalink
[notes] Add support for multiple authors
Browse files Browse the repository at this point in the history
This commit adds code to support export of
multiple authors from the changelog entry.

Signed-off-by: Venu Vardhan Reddy Tekula <venuvardhanreddytekula8@gmail.com>
  • Loading branch information
vchrombie committed Jun 20, 2022
1 parent e1dd4db commit 6255573
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
12 changes: 10 additions & 2 deletions release_tools/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,20 @@ def compose(self, project, entries):

authors = self._extract_authors(project)

def _check_author_exists_already(author):
if author not in authors:
authors.append(author)

for _, entry_list in sorted(entries.items()):
for entry in ReleaseNotesComposer._sort_entries_by_id(entry_list):
if not entry.author:
continue
if entry.author not in authors:
authors.append(entry.author)

if type(entry.author) is list:
for author in entry.author:
_check_author_exists_already(author)
else:
_check_author_exists_already(entry.author)

content = ""

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Notes command supports multiple authors in changelog entries
category: added
author: null
issue: 49
notes: >
The notes command supports exporting of multiple authors
from the changelog entries. You can add more than one
author to the changelog entry by defining them as
```
author:
- John Smith <jsmith@example.com>
- John Doe <jdoe@example.com>
```
10 changes: 6 additions & 4 deletions tests/test_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,19 @@ def setup_unreleased_entries(dirpath):
"second feature",
"final feature",
"another fix",
"final fix",
]
categories = [
CategoryChange.ADDED,
CategoryChange.FIXED,
CategoryChange.ADDED,
CategoryChange.ADDED,
CategoryChange.FIXED,
CategoryChange.FIXED,
]
authors = ['jsmith', 'jdoe', 'jsmith', 'jdoe', 'jsmith']
issues = [1, 2, 3, 'null', 'null']
notes = [True, False, False, False, True]
authors = ['jsmith', 'jdoe', 'jsmith', 'jdoe', 'jsmith', '\n- jsmith\n- jdoe']
issues = [1, 2, 3, 'null', 'null', 'null']
notes = [True, False, False, False, True, False]
notes_txt = (
">\n"
" Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor"
Expand All @@ -137,7 +139,7 @@ def setup_unreleased_entries(dirpath):
os.makedirs(dirpath)

# Create some entries
for x in range(0, 5):
for x in range(0, 6):
filepath = os.path.join(dirpath, str(x) + '.yml')

with open(filepath, mode='w') as fd:
Expand Down

0 comments on commit 6255573

Please sign in to comment.