gcc-changelog: handle entries with multi-line file lists
This extends the ChangeLog entries parsing machinery to handle entries that cover multiple files spanning over multiple lines. For instance: * first_file_patched.c, second_file_patched.c, third_file_patched.c, fourth_file_patched.c: Do things. contrib/ * gcc-changelog/git_commit.py (ChangeLogEntry): Handle entries with multi-line file lists. * gcc-changelog/test_email.py: New testcase. * gcc-changelog/test_patches.txt: Likewise.
This commit is contained in:
parent
bb07057a31
commit
519f250645
@ -185,14 +185,32 @@ class ChangeLogEntry:
|
||||
@property
|
||||
def files(self):
|
||||
files = []
|
||||
|
||||
# Whether the content currently processed is between a star prefix the
|
||||
# end of the file list: a colon or an open paren.
|
||||
in_location = False
|
||||
|
||||
for line in self.lines:
|
||||
# If this line matches the star prefix, start the location
|
||||
# processing on the information that follows the star.
|
||||
m = star_prefix_regex.match(line)
|
||||
if m:
|
||||
in_location = True
|
||||
line = m.group('content')
|
||||
|
||||
if in_location:
|
||||
# Strip everything that is not a filename in "line": entities
|
||||
# "(NAME)", entry text (the colon, if present, and anything
|
||||
# that follows it).
|
||||
if '(' in line:
|
||||
line = line[:line.index('(')]
|
||||
in_location = False
|
||||
if ':' in line:
|
||||
line = line[:line.index(':')]
|
||||
in_location = False
|
||||
|
||||
# At this point, all that 's left is a list of filenames
|
||||
# separated by commas and whitespaces.
|
||||
for file in line.split(','):
|
||||
file = file.strip()
|
||||
if file:
|
||||
|
@ -286,3 +286,12 @@ class TestGccChangelog(unittest.TestCase):
|
||||
email = self.from_patch_glob('0001-Update-merge.sh-to-reflect.patch')
|
||||
assert (email.changelog_entries[0].lines[0]
|
||||
== '\t* LOCAL_PATCHES: Use git hash instead of SVN id.')
|
||||
|
||||
def test_multiline_file_list(self):
|
||||
email = self.from_patch_glob(
|
||||
'0001-Ada-Reuse-Is_Package_Or_Generic_Package-where-possib.patch')
|
||||
assert (email.changelog_entries[0].files
|
||||
== ['contracts.adb', 'einfo.adb', 'exp_ch9.adb',
|
||||
'sem_ch12.adb', 'sem_ch4.adb', 'sem_ch7.adb',
|
||||
'sem_ch8.adb', 'sem_elab.adb', 'sem_type.adb',
|
||||
'sem_util.adb'])
|
||||
|
@ -2650,4 +2650,94 @@ index dfa7bf3d196..3f4f1629a22 100755
|
||||
|
||||
--
|
||||
2.26.2
|
||||
=== 0001-Ada-Reuse-Is_Package_Or_Generic_Package-where-possib.patch ===
|
||||
From 557b268fffffdeb0980a17411f458eee333f55c6 Mon Sep 17 00:00:00 2001
|
||||
From: Piotr Trojanek <trojanek@adacore.com>
|
||||
Date: Thu, 12 Dec 2019 11:45:24 +0100
|
||||
Subject: [PATCH] [Ada] Reuse Is_Package_Or_Generic_Package where possible
|
||||
|
||||
2020-05-26 Piotr Trojanek <trojanek@adacore.com>
|
||||
|
||||
gcc/ada/
|
||||
|
||||
* contracts.adb, einfo.adb, exp_ch9.adb, sem_ch12.adb,
|
||||
sem_ch4.adb, sem_ch7.adb, sem_ch8.adb, sem_elab.adb,
|
||||
sem_type.adb, sem_util.adb: Reuse Is_Package_Or_Generic_Package
|
||||
where possible (similarly, reuse Is_Concurrent_Type if it was
|
||||
possible in the same expressions).
|
||||
---
|
||||
gcc/ada/contracts.adb | 2 +-
|
||||
gcc/ada/einfo.adb | 22 +++++++++++-----------
|
||||
gcc/ada/exp_ch9.adb | 2 +-
|
||||
gcc/ada/sem_ch12.adb | 2 +-
|
||||
gcc/ada/sem_ch4.adb | 2 +-
|
||||
gcc/ada/sem_ch7.adb | 6 +++---
|
||||
gcc/ada/sem_ch8.adb | 6 +++---
|
||||
gcc/ada/sem_elab.adb | 2 +-
|
||||
gcc/ada/sem_type.adb | 2 +-
|
||||
gcc/ada/sem_util.adb | 6 +++---
|
||||
10 files changed, 26 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
|
||||
index 981bb91..d58f136 100644
|
||||
--- a/gcc/ada/contracts.adb
|
||||
+++ b/gcc/ada/contracts.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/einfo.adb b/gcc/ada/einfo.adb
|
||||
index 98b508f..1df8ed0 100644
|
||||
--- a/gcc/ada/einfo.adb
|
||||
+++ b/gcc/ada/einfo.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
|
||||
index 64ac353..392a221 100644
|
||||
--- a/gcc/ada/exp_ch9.adb
|
||||
+++ b/gcc/ada/exp_ch9.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
|
||||
index dc3a3c2..209e060 100644
|
||||
--- a/gcc/ada/sem_ch12.adb
|
||||
+++ b/gcc/ada/sem_ch12.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
|
||||
index 5910112..702f265 100644
|
||||
--- a/gcc/ada/sem_ch4.adb
|
||||
+++ b/gcc/ada/sem_ch4.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
|
||||
index 6d9a1db..f217dfd 100644
|
||||
--- a/gcc/ada/sem_ch7.adb
|
||||
+++ b/gcc/ada/sem_ch7.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
|
||||
index f083f7c..7f50b40 100644
|
||||
--- a/gcc/ada/sem_ch8.adb
|
||||
+++ b/gcc/ada/sem_ch8.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb
|
||||
index f3cac46..dbf3fac 100644
|
||||
--- a/gcc/ada/sem_elab.adb
|
||||
+++ b/gcc/ada/sem_elab.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb
|
||||
index e5d01dd..1868568 100644
|
||||
--- a/gcc/ada/sem_type.adb
|
||||
+++ b/gcc/ada/sem_type.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
|
||||
index b980b4c..c1b1d9e 100644
|
||||
--- a/gcc/ada/sem_util.adb
|
||||
+++ b/gcc/ada/sem_util.adb
|
||||
@@ -0,0 +1 @@
|
||||
+
|
||||
--
|
||||
2.1.4
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user