git_commit: fix duplicite email address.
authorMartin Liska <mliska@suse.cz>
Fri, 29 May 2020 06:59:04 +0000 (08:59 +0200)
committerMartin Liska <mliska@suse.cz>
Fri, 29 May 2020 07:00:00 +0000 (09:00 +0200)
The patch is about to handle situations like seen
in 3ea6977d0f1813d982743a09660eec1760e981ec.

contrib/ChangeLog:

* gcc-changelog/git_commit.py: Properly
handle duplicite authors.
* gcc-changelog/test_email.py: New test.
* gcc-changelog/test_patches.txt: New patch.

contrib/gcc-changelog/git_commit.py
contrib/gcc-changelog/test_email.py
contrib/gcc-changelog/test_patches.txt

index a24a251d8f39260ef7b5c46551345da8c48fda37..084e83c18ccc17b2e5c8c631ebb9e2f151b368e9 100755 (executable)
@@ -232,6 +232,12 @@ class ChangeLogEntry:
     def is_empty(self):
         return not self.lines and self.prs == self.initial_prs
 
+    def contains_author(self, author):
+        for author_lines in self.author_lines:
+            if author_lines[0] == author:
+                return True
+        return False
+
 
 class GitCommit:
     def __init__(self, hexsha, date, author, body, modified_files,
@@ -408,7 +414,7 @@ class GitCommit:
                         self.changelog_entries.append(last_entry)
                         will_deduce = True
                 elif author_tuple:
-                    if author_tuple not in last_entry.author_lines:
+                    if not last_entry.contains_author(author_tuple[0]):
                         last_entry.author_lines.append(author_tuple)
                     continue
 
index 23372f082a09eb9de93d78662fd30d969af1e14f..e73b3626473b4682c68960942b58c2b9762c984a 100755 (executable)
 
 import os
 import tempfile
-import unidiff
 import unittest
 
 from git_email import GitEmail
 
+import unidiff
 
 script_path = os.path.dirname(os.path.realpath(__file__))
 
@@ -305,3 +305,10 @@ class TestGccChangelog(unittest.TestCase):
         email = self.from_patch_glob(
             '0001-Ada-Add-support-for-XDR-streaming-in-the-default-run.patch')
         assert not email.errors
+
+    def test_duplicite_author_lines(self):
+        email = self.from_patch_glob('0001-Fortran-type-is-real-kind-1.patch')
+        assert (email.changelog_entries[0].author_lines[0][0]
+                == 'Steven G. Kargl  <kargl@gcc.gnu.org>')
+        assert (email.changelog_entries[0].author_lines[1][0]
+                == 'Mark Eggleston  <markeggleston@gcc.gnu.org>')
index cc81fcd32b864d4f581bdc48ec3270d6ecb86137..76037c33f93859e422aa209aa3bddec2371d7f4b 100644 (file)
@@ -2893,4 +2893,55 @@ index 9e0263b431d..37f3d030e3f 100644
 +
 -- 
 2.20.1
+=== 0001-Fortran-type-is-real-kind-1.patch ===
+From 3ea6977d0f1813d982743a09660eec1760e981ec Mon Sep 17 00:00:00 2001
+From: Mark Eggleston <markeggleston@gcc.gnu.org>
+Date: Wed, 1 Apr 2020 09:52:41 +0100
+Subject: [PATCH] Fortran  : "type is( real(kind(1.)) )" spurious syntax error
+ PR94397
+
+Based on a patch in the comments of the PR. That patch fixed this
+problem but caused the test cases for PR93484 to fail. It has been
+changed to reduce initialisation expressions if the expression is
+not EXPR_VARIABLE and not EXPR_CONSTANT.
+
+2020-05-28  Steven G. Kargl  <kargl@gcc.gnu.org>
+           Mark Eggleston  <markeggleston@gcc.gnu.org>
+
+gcc/fortran/
+
+       PR fortran/94397
+       * match.c (gfc_match_type_spec): New variable ok initialised
+       to true. Set ok with the return value of gfc_reduce_init_expr
+       called only if the expression is not EXPR_CONSTANT and is not
+       EXPR_VARIABLE. Add !ok to the check for type not being integer
+       or the rank being greater than zero.
+
+2020-05-28  Mark Eggleston  <markeggleston@gcc.gnu.org>
+
+gcc/testsuite/
+
+       PR fortran/94397
+       * gfortran.dg/pr94397.F90: New test.
+---
+ gcc/fortran/match.c                   |  5 ++++-
+ gcc/testsuite/gfortran.dg/pr94397.F90 | 26 ++++++++++++++++++++++++++
+ 2 files changed, 30 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gfortran.dg/pr94397.F90
 
+diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
+index 8ae34a94a95..82d2b5087e5 100644
+--- a/gcc/fortran/match.c
++++ b/gcc/fortran/match.c
+@@ -1 +1,2 @@
++
+diff --git a/gcc/testsuite/gfortran.dg/pr94397.F90 b/gcc/testsuite/gfortran.dg/pr94397.F90
+new file mode 100644
+index 00000000000..fda10c1a88b
+--- /dev/null
++++ b/gcc/testsuite/gfortran.dg/pr94397.F90
+@@ -0,0 +1 @@
++
+-- 
+2.26.2