public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: gcc-patches@gcc.gnu.org
Cc: Thomas Schwinge <thomas@codesourcery.com>
Subject: [PATCH (pushed)] mklog: do not parse binary file for PR entry
Date: Mon, 12 Dec 2022 13:25:21 +0100	[thread overview]
Message-ID: <a691b49a-b340-2c23-f047-ae546b183122@suse.cz> (raw)

contrib/ChangeLog:

	* mklog.py: Do not search PR entry in a file that is binary.
---
 contrib/mklog.py | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/contrib/mklog.py b/contrib/mklog.py
index 3a6ec681b65..358b7fc6b8b 100755
--- a/contrib/mklog.py
+++ b/contrib/mklog.py
@@ -186,23 +186,25 @@ def generate_changelog(data, no_functions=False, fill_pr_titles=False,
             # contains commented code which a note that it
             # has not been tested due to a certain PR or DR.
             this_file_prs = []
-            for line in list(file)[0][0:10]:
-                m = pr_regex.search(line.value)
-                if m:
-                    pr = m.group('pr')
-                    if pr not in prs:
-                        prs.append(pr)
-                        this_file_prs.append(pr.split('/')[-1])
-                else:
-                    m = dr_regex.search(line.value)
+            if not file.is_binary_file:
+                for line in list(file)[0][0:10]:
+                    m = pr_regex.search(line.value)
                     if m:
-                        dr = m.group('dr')
-                        if dr not in prs:
-                            prs.append(dr)
-                            this_file_prs.append(dr.split('/')[-1])
-                    elif dg_regex.search(line.value):
-                        # Found dg-warning/dg-error line
-                        break
+                        pr = m.group('pr')
+                        if pr not in prs:
+                            prs.append(pr)
+                            this_file_prs.append(pr.split('/')[-1])
+                    else:
+                        m = dr_regex.search(line.value)
+                        if m:
+                            dr = m.group('dr')
+                            if dr not in prs:
+                                prs.append(dr)
+                                this_file_prs.append(dr.split('/')[-1])
+                        elif dg_regex.search(line.value):
+                            # Found dg-warning/dg-error line
+                            break
+
             # PR number in the file name
             fname = os.path.basename(file.path)
             m = pr_filename_regex.search(fname)
-- 
2.38.1


                 reply	other threads:[~2022-12-12 12:25 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=a691b49a-b340-2c23-f047-ae546b183122@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=thomas@codesourcery.com \
    /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).