public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1796] mklog: fill-up subject prefix only for a single PR
Date: Fri, 22 Jul 2022 09:41:32 +0000 (GMT)	[thread overview]
Message-ID: <20220722094132.88209383541C@sourceware.org> (raw)

https://gcc.gnu.org/g:03c0b06420b7d9331c61d1958834ca0d269ee6f1

commit r13-1796-g03c0b06420b7d9331c61d1958834ca0d269ee6f1
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Jul 22 11:39:58 2022 +0200

    mklog: fill-up subject prefix only for a single PR
    
    contrib/ChangeLog:
    
            * mklog.py: Use component: [PR xyz] only when one PR is used.

Diff:
---
 contrib/mklog.py | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/contrib/mklog.py b/contrib/mklog.py
index cd5ef0bcc74..8693767a7f6 100755
--- a/contrib/mklog.py
+++ b/contrib/mklog.py
@@ -73,8 +73,6 @@ PATCH must be generated using diff(1)'s -up or -cp options
 script_folder = os.path.realpath(__file__)
 root = os.path.dirname(os.path.dirname(script_folder))
 
-firstpr = ''
-
 
 def find_changelog(path):
     folder = os.path.split(path)[0]
@@ -157,12 +155,13 @@ def get_rel_path_if_prefixed(path, folder):
 
 def generate_changelog(data, no_functions=False, fill_pr_titles=False,
                        additional_prs=None):
+    global prs
+    prs = []
+
     changelogs = {}
     changelog_list = []
-    prs = []
     out = ''
     diff = PatchSet(data)
-    global firstpr
 
     if additional_prs:
         for apr in additional_prs:
@@ -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:
                     prs.append(pr2)
 
-    if prs:
-        firstpr = prs[0]
-
     if fill_pr_titles:
         out += get_pr_titles(prs)
 
@@ -372,11 +368,12 @@ if __name__ == '__main__':
             end = lines[len(start):]
             with open(args.changelog, 'w') as f:
                 if not start or not start[0]:
-                    # initial commit subject line 'component: [PRnnnnn]'
-                    m = prnum_regex.match(firstpr)
-                    if m:
-                        title = f'{m.group("comp")}: [PR{m.group("num")}]'
-                        start.insert(0, title)
+                    if len(prs) == 1:
+                        # initial commit subject line 'component: [PRnnnnn]'
+                        m = prnum_regex.match(prs[0])
+                        if m:
+                            title = f'{m.group("comp")}: [PR{m.group("num")}]'
+                            start.insert(0, title)
                 if start:
                     # append empty line
                     if start[-1] != '':


                 reply	other threads:[~2022-07-22  9:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722094132.88209383541C@sourceware.org \
    --to=marxin@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).