public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r9-9925] gcc-changelog: sync from master.
@ 2022-01-24 12:46 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-01-24 12:46 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3406714007ad09ceb15facee44e8bc749bb40cc9

commit r9-9925-g3406714007ad09ceb15facee44e8bc749bb40cc9
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jan 24 13:44:57 2022 +0100

    gcc-changelog: sync from master.
    
    contrib/ChangeLog:
    
            * gcc-changelog/git_commit.py: Sync from master.
            * gcc-changelog/test_email.py: Likewise.
            * gcc-changelog/test_patches.txt: Likewise.

Diff:
---
 contrib/gcc-changelog/git_commit.py    | 12 +++--
 contrib/gcc-changelog/test_email.py    |  5 +++
 contrib/gcc-changelog/test_patches.txt | 82 ++++++++++++++++++++++++++++++++++
 3 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 27a1d59b211..95dc49e5d48 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -718,9 +718,15 @@ class GitCommit:
                         self.changelog_entries.append(entry)
                     # strip prefix of the file
                     assert file.startswith(entry.folder)
-                    file = file[len(entry.folder):].lstrip('/')
-                    entry.lines.append('\t* %s: New file.' % file)
-                    entry.files.append(file)
+                    # do not allow auto-addition of New files
+                    # for the top-level folder
+                    if entry.folder:
+                        file = file[len(entry.folder):].lstrip('/')
+                        entry.lines.append('\t* %s: New file.' % file)
+                        entry.files.append(file)
+                    else:
+                        msg = 'new file in the top-level folder not mentioned in a ChangeLog'
+                        self.errors.append(Error(msg, file))
                 else:
                     used_pattern = [p for p in mentioned_patterns
                                     if file.startswith(p)]
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index a4796dbbe94..c56f6da513a 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -446,3 +446,8 @@ class TestGccChangelog(unittest.TestCase):
         email = self.from_patch_glob('non-ascii-email.patch')
         assert (email.errors[0].message ==
                 'non-ASCII characters in git commit email address (jbglaw@ług-owl.de)')
+
+    def test_new_file_in_root_folder(self):
+        email = self.from_patch_glob('toplev-new-file.patch')
+        assert (email.errors[0].message ==
+                'new file in the top-level folder not mentioned in a ChangeLog')
diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt
index 98a0d3f1ee0..95ad961f2d3 100644
--- a/contrib/gcc-changelog/test_patches.txt
+++ b/contrib/gcc-changelog/test_patches.txt
@@ -3489,3 +3489,85 @@ index 2a9917cde62..0033b0004b3 100644
 @@ -0,0 +1,1 @@
 +
 -- 
+
+=== toplev-new-file.patch ===
+From 05e37b6e65027188f08e6374c7d356d75b54738e Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Mon, 24 Jan 2022 12:46:27 +0100
+Subject: [PATCH] New file.
+
+ChangeLog:
+
+	* Makefile.in: Update.
+
+gcc/ChangeLog:
+
+	* ipa-icf.cc: Update.
+---
+ Makefile.am     | 1 +
+ Makefile.in     | 1 +
+ gcc/ipa-icf.cc  | 1 +
+ gcc/ipa-icf2.cc | 1 +
+ 4 files changed, 4 insertions(+)
+ create mode 100644 Makefile.am
+ create mode 100644 gcc/ipa-icf2.cc
+
+diff --git a/Makefile.am b/Makefile.am
+new file mode 100644
+index 00000000000..f0129caae3d
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1 @@
++new file.
+diff --git a/Makefile.in b/Makefile.in
+index 79c77fccf0f..7a090030119 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -1,4 +1,5 @@
+ 
++
+ # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
+ #
+ # Makefile for directory with subdirs to build.
+diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc
+index 765ae746745..15735b6684f 100644
+--- a/gcc/ipa-icf.cc
++++ b/gcc/ipa-icf.cc
+@@ -1,3 +1,4 @@
++
+ /* Interprocedural Identical Code Folding pass
+    Copyright (C) 2014-2022 Free Software Foundation, Inc.
+ 
+diff --git a/gcc/ipa-icf2.cc b/gcc/ipa-icf2.cc
+new file mode 100644
+index 00000000000..c49c556e0e4
+--- /dev/null
++++ b/gcc/ipa-icf2.cc
+@@ -0,0 +1 @@
++tt
+-- 
+2.34.1
+
+From 80c9d63af350b280bfccb82adb3867c25a25e6d0 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Mon, 24 Jan 2022 12:17:09 +0100
+Subject: [PATCH] Add Makefile.am file.
+
+Foo bar.
+
+ChangeLog:
+
+---
+ Makefile.am | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ create mode 100644 Makefile.am
+
+diff --git a/Makefile.am b/Makefile.am
+new file mode 100644
+index 00000000000..d6459e00543
+--- /dev/null
++++ b/Makefile.am
+@@ -0,0 +1 @@
++xxx
+-- 
+2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-24 12:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 12:46 [gcc r9-9925] gcc-changelog: sync from master Martin Liska

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).