diff options
author | Alexandre Oliva <oliva@adacore.com> | 2020-07-07 09:02:01 +0200 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-07-07 09:05:10 +0200 |
commit | a759bfc7cf238b9fc5bf97884297fc69d8cdf2b5 (patch) | |
tree | fd2ec675910cbba7708d5651295fe2466ed9ee1b /contrib/gcc-changelog/git_commit.py | |
parent | c50502ca4ebb4d4bd2df9edf1eb5c53aacfa0a1e (diff) | |
download | gcc-a759bfc7cf238b9fc5bf97884297fc69d8cdf2b5.zip gcc-a759bfc7cf238b9fc5bf97884297fc69d8cdf2b5.tar.gz gcc-a759bfc7cf238b9fc5bf97884297fc69d8cdf2b5.tar.bz2 |
accept <case> and [cond] in ChangeLog
Only '(' and ':' currently terminate file lists in ChangeLog entries
in the ChangeLog parser. This rules out such legitimate entries as:
* filename <CASE>:
* filename [COND]:
This patch extends the ChangeLog parser to recognize these forms.
for contrib/ChangeLog
* gcc-changelog/git_commit.py: Support CASE and COND.
* gcc-changelog/test_patches.txt: Add test.
* gcc-changelog/test_email.py: Add test.
Co-Authored-By: Martin Liska <mliska@suse.cz>
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
-rwxr-xr-x | contrib/gcc-changelog/git_commit.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 4d003cc..827976c 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -154,6 +154,7 @@ changelog_regex = re.compile(r'^(?:[fF]or +)?([a-z0-9+-/]*)ChangeLog:?') pr_regex = re.compile(r'\tPR (?P<component>[a-z+-]+\/)?([0-9]+)$') dr_regex = re.compile(r'\tDR ([0-9]+)$') star_prefix_regex = re.compile(r'\t\*(?P<spaces>\ *)(?P<content>.*)') +end_of_location_regex = re.compile(r'[\[<(:]') LINE_LIMIT = 100 TAB_WIDTH = 8 @@ -204,14 +205,13 @@ class ChangeLogEntry: 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(':')] + # Strip everything that is not a filename in "line": + # entities "(NAME)", cases "<PATTERN>", conditions + # "[COND]", entry text (the colon, if present, and + # anything that follows it). + m = end_of_location_regex.search(line) + if m: + line = line[:m.start()] in_location = False # At this point, all that's left is a list of filenames |