Skip to content
Snippets Groups Projects
Commit 03c0b064 authored by Martin Liska's avatar Martin Liska
Browse files

mklog: fill-up subject prefix only for a single PR

contrib/ChangeLog:

	* mklog.py: Use component: [PR xyz] only when one PR is used.
parent d85e5aeb
No related branches found
No related tags found
No related merge requests found
...@@ -73,8 +73,6 @@ PATCH must be generated using diff(1)'s -up or -cp options ...@@ -73,8 +73,6 @@ PATCH must be generated using diff(1)'s -up or -cp options
script_folder = os.path.realpath(__file__) script_folder = os.path.realpath(__file__)
root = os.path.dirname(os.path.dirname(script_folder)) root = os.path.dirname(os.path.dirname(script_folder))
firstpr = ''
def find_changelog(path): def find_changelog(path):
folder = os.path.split(path)[0] folder = os.path.split(path)[0]
...@@ -157,12 +155,13 @@ def get_rel_path_if_prefixed(path, folder): ...@@ -157,12 +155,13 @@ def get_rel_path_if_prefixed(path, folder):
def generate_changelog(data, no_functions=False, fill_pr_titles=False, def generate_changelog(data, no_functions=False, fill_pr_titles=False,
additional_prs=None): additional_prs=None):
global prs
prs = []
changelogs = {} changelogs = {}
changelog_list = [] changelog_list = []
prs = []
out = '' out = ''
diff = PatchSet(data) diff = PatchSet(data)
global firstpr
if additional_prs: if additional_prs:
for apr in additional_prs: for apr in additional_prs:
...@@ -212,9 +211,6 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False, ...@@ -212,9 +211,6 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False,
if pr not in this_file_prs and pr2 not in prs: if pr not in this_file_prs and pr2 not in prs:
prs.append(pr2) prs.append(pr2)
if prs:
firstpr = prs[0]
if fill_pr_titles: if fill_pr_titles:
out += get_pr_titles(prs) out += get_pr_titles(prs)
...@@ -372,11 +368,12 @@ if __name__ == '__main__': ...@@ -372,11 +368,12 @@ if __name__ == '__main__':
end = lines[len(start):] end = lines[len(start):]
with open(args.changelog, 'w') as f: with open(args.changelog, 'w') as f:
if not start or not start[0]: if not start or not start[0]:
# initial commit subject line 'component: [PRnnnnn]' if len(prs) == 1:
m = prnum_regex.match(firstpr) # initial commit subject line 'component: [PRnnnnn]'
if m: m = prnum_regex.match(prs[0])
title = f'{m.group("comp")}: [PR{m.group("num")}]' if m:
start.insert(0, title) title = f'{m.group("comp")}: [PR{m.group("num")}]'
start.insert(0, title)
if start: if start:
# append empty line # append empty line
if start[-1] != '': if start[-1] != '':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment