On 6/22/20 3:15 PM, Alexandre Oliva wrote:
On May 26, 2020, Martin Liška <mli...@suse.cz> wrote:

On 5/26/20 12:15 PM, Pierre-Marie de Rodat wrote:
         * contracts.adb, einfo.adb, exp_ch9.adb, sem_ch12.adb,

It's not supported right now and it will make the filename parsing
much more complicated.

Hello.

I support the patch:


Another colleague recently run into a problem with either:

        * $filename <$case>:

or

        * $filename [$condition]:

I can't recall which one it was, but the following patch is supposed to
implement both.  Alas, I couldn't figure out how to test it:
git_check_commit.py is failing with:

Traceback (most recent call last):
   File "contrib/gcc-changelog/git_check_commit.py", line 38, in <module>
     not args.non_strict_mode):
   File "/l/tmp/build/gcc/contrib/gcc-changelog/git_repository.py", line 57, in 
parse_git_revisions
     elif file.renamed_file:
AttributeError: 'Diff' object has no attribute 'renamed_file'


accept <case> and [cond] in ChangeLog

From: Alexandre Oliva <ol...@adacore.com>

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.
---
  contrib/gcc-changelog/git_commit.py |   16 ++++++++--------
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py 
b/contrib/gcc-changelog/git_commit.py
index 4a78793..537c667 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'[[<(:]')

Please escape the '[':
+end_of_location_regex = re.compile(r'[\[<(:]')

and please a test-case for it.

Thanks,
Martin

LINE_LIMIT = 100
  TAB_WIDTH = 8
@@ -203,14 +204,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



Reply via email to