From 697eab1b3e8936fd6932cc81646934651337cc39 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 29 May 2020 08:59:04 +0200 Subject: [PATCH] git_commit: fix duplicite email address. 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 | 8 +++- contrib/gcc-changelog/test_email.py | 9 ++++- contrib/gcc-changelog/test_patches.txt | 51 ++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index a24a251d8f3..084e83c18cc 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -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 diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 23372f082a0..e73b3626473 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -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 ') + assert (email.changelog_entries[0].author_lines[1][0] + == 'Mark Eggleston ') diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index cc81fcd32b8..76037c33f93 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -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 +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 + Mark Eggleston + +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 + +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 -- 2.30.2