aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc-changelog/git_commit.py
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2020-05-26 16:22:16 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-05-26 17:45:58 +0200
commit519f2506456ffcf79782f7be21a8463d1776b16c (patch)
tree90436a9eadd8be6fecdba9fcc732376da01e7347 /contrib/gcc-changelog/git_commit.py
parentbb07057a316f7f8c3daa1a4dd67fd3c5d9d450c7 (diff)
downloadgcc-519f2506456ffcf79782f7be21a8463d1776b16c.zip
gcc-519f2506456ffcf79782f7be21a8463d1776b16c.tar.gz
gcc-519f2506456ffcf79782f7be21a8463d1776b16c.tar.bz2
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.
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
-rwxr-xr-xcontrib/gcc-changelog/git_commit.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 6f99d91..a24a251 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -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: