public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] gcc-changelog: Improve git_commit.py diagnostics
@ 2020-06-13  2:49 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-13  2:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1ea9a0b74e60e6cdca6372403d7bd564a5410d82

commit 1ea9a0b74e60e6cdca6372403d7bd564a5410d82
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 10 09:36:34 2020 +0200

    gcc-changelog: Improve git_commit.py diagnostics
    
    This changes some error messages to be more self-consistent and to fix
    some grammar.
    
    contrib/ChangeLog:
    
            * gcc-changelog/git_commit.py (GitCommit.parse_changelog):
            Improve error strings.
            * gcc-changelog/test_email.py: Update expected errors.

Diff:
---
 contrib/gcc-changelog/git_commit.py | 16 ++++++++--------
 contrib/gcc-changelog/test_email.py | 10 +++++-----
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index f85d4c83c63..0b350ba7fda 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -377,8 +377,8 @@ class GitCommit:
                 elif additional_author_regex.match(line):
                     m = additional_author_regex.match(line)
                     if len(m.group('spaces')) != 4:
-                        msg = 'additional author must prepend with tab ' \
-                              'and 4 spaces'
+                        msg = 'additional author must be indented with '\
+                              'one tab and four spaces'
                         self.errors.append(Error(msg, line))
                     else:
                         author_tuple = (m.group('name'), None)
@@ -438,15 +438,14 @@ class GitCommit:
                     m = star_prefix_regex.match(line)
                     if m:
                         if len(m.group('spaces')) != 1:
-                            err = Error('one space should follow asterisk',
-                                        line)
-                            self.errors.append(err)
+                            msg = 'one space should follow asterisk'
+                            self.errors.append(Error(msg, line))
                         else:
                             last_entry.lines.append(line)
                     else:
                         if last_entry.is_empty:
                             msg = 'first line should start with a tab, ' \
-                                  'asterisk and space'
+                                  'an asterisk and a space'
                             self.errors.append(Error(msg, line))
                         else:
                             last_entry.lines.append(line)
@@ -527,7 +526,7 @@ class GitCommit:
         used_patterns = set()
         for entry in self.changelog_entries:
             if not entry.files:
-                msg = 'ChangeLog must contain at least one file entry'
+                msg = 'no files mentioned for ChangeLog in directory'
                 self.errors.append(Error(msg, entry.folder))
             assert not entry.folder.endswith('/')
             for file in entry.files:
@@ -540,7 +539,8 @@ class GitCommit:
                 if not self.is_changelog_filename(x[0])]
         changed_files = set(cand)
         for file in sorted(mentioned_files - changed_files):
-            self.errors.append(Error('file not changed in a patch', file))
+            msg = 'unchanged file mentioned in a ChangeLog'
+            self.errors.append(Error(msg, file))
         for file in sorted(changed_files - mentioned_files):
             if not self.in_ignored_location(file):
                 if file in self.new_files:
diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py
index 04ddad3f100..df57bb5c94a 100755
--- a/contrib/gcc-changelog/test_email.py
+++ b/contrib/gcc-changelog/test_email.py
@@ -105,7 +105,7 @@ class TestGccChangelog(unittest.TestCase):
         email = self.from_patch_glob('0096')
         assert email.errors
         err = email.errors[0]
-        assert err.message == 'file not changed in a patch'
+        assert err.message == 'unchanged file mentioned in a ChangeLog'
         assert err.line == 'gcc/testsuite/gcc.target/aarch64/' \
                            'advsimd-intrinsics/vdot-compile-3-1.c'
 
@@ -161,8 +161,8 @@ class TestGccChangelog(unittest.TestCase):
 
     def test_additional_author_list(self):
         email = self.from_patch_glob('0342')
-        assert (email.errors[1].message == 'additional author must prepend '
-                                           'with tab and 4 spaces')
+        assert (email.errors[1].message == 'additional author must be indented '
+                                           'with one tab and four spaces')
 
     def test_trailing_whitespaces(self):
         email = self.get_git_email('trailing-whitespaces.patch')
@@ -260,8 +260,8 @@ class TestGccChangelog(unittest.TestCase):
 
     def test_wrong_changelog_entry(self):
         email = self.from_patch_glob('0020-IPA-Avoid')
-        assert (email.errors[0].message
-                == 'first line should start with a tab, asterisk and space')
+        msg = 'first line should start with a tab, an asterisk and a space'
+        assert (email.errors[0].message == msg)
 
     def test_cherry_pick_format(self):
         email = self.from_patch_glob('0001-c-Alias.patch')


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-13  2:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13  2:49 [gcc(refs/users/guojiufu/heads/personal-branch)] gcc-changelog: Improve git_commit.py diagnostics Jiu Fu Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).