diff options
author | Martin Liska <mliska@suse.cz> | 2020-11-30 17:19:41 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2020-11-30 17:19:41 +0100 |
commit | 57cbb7acdbcb83b827f8e241568559f0c54e8af6 (patch) | |
tree | afede42268016b52360aa95d50fdceb9308bdf9e /contrib | |
parent | e40fece7c9b3731f4cff060f712c132ff100cab4 (diff) | |
download | gcc-57cbb7acdbcb83b827f8e241568559f0c54e8af6.zip gcc-57cbb7acdbcb83b827f8e241568559f0c54e8af6.tar.gz gcc-57cbb7acdbcb83b827f8e241568559f0c54e8af6.tar.bz2 |
changelog: add hint for a file mismatch
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Suggest close file for
'unchanged file mentioned in a ChangeLog' error.
* gcc-changelog/test_email.py: Test it.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/gcc-changelog/git_commit.py | 4 | ||||
-rwxr-xr-x | contrib/gcc-changelog/test_email.py | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index 57fba75..0c43816 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -16,6 +16,7 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. */ +import difflib import os import re @@ -576,6 +577,9 @@ class GitCommit: changed_files = set(cand) for file in sorted(mentioned_files - changed_files): msg = 'unchanged file mentioned in a ChangeLog' + candidates = difflib.get_close_matches(file, changed_files, 1) + if candidates: + msg += f' (did you mean "{candidates[0]}"?)' self.errors.append(Error(msg, file)) for file in sorted(changed_files - mentioned_files): if not self.in_ignored_location(file): diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 48ecc1e..8f5129e 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -113,7 +113,9 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0096') assert email.errors err = email.errors[0] - assert err.message == 'unchanged file mentioned in a ChangeLog' + assert err.message == 'unchanged file mentioned in a ChangeLog (did ' \ + 'you mean "gcc/testsuite/gcc.target/aarch64/' \ + 'advsimd-intrinsics/vdot-3-1.c"?)' assert err.line == 'gcc/testsuite/gcc.target/aarch64/' \ 'advsimd-intrinsics/vdot-compile-3-1.c' |