git_commit: fix duplicite email address.

The patch is about to handle situations like seen
in 3ea6977d0f.

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.
This commit is contained in:
Martin Liska 2020-05-29 08:59:04 +02:00
parent 53ffb43a79
commit 697eab1b3e
No known key found for this signature in database
GPG key ID: 4DC182DC0FA73785
3 changed files with 66 additions and 2 deletions

View file

@ -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

View file

@ -18,11 +18,11 @@
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>')

View 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