aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc-changelog/git_commit.py
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc-changelog/git_commit.py')
-rwxr-xr-xcontrib/gcc-changelog/git_commit.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py
index 60377b6..27a1d59 100755
--- a/contrib/gcc-changelog/git_commit.py
+++ b/contrib/gcc-changelog/git_commit.py
@@ -197,9 +197,10 @@ def decode_path(path):
class Error:
- def __init__(self, message, line=None):
+ def __init__(self, message, line=None, details=None):
self.message = message
self.line = line
+ self.details = details
def __repr__(self):
s = self.message
@@ -687,9 +688,11 @@ class GitCommit:
for file in sorted(mentioned_files - changed_files):
msg = 'unchanged file mentioned in a ChangeLog'
candidates = difflib.get_close_matches(file, changed_files, 1)
+ details = None
if candidates:
msg += f' (did you mean "{candidates[0]}"?)'
- self.errors.append(Error(msg, file))
+ details = '\n'.join(difflib.Differ().compare([file], [candidates[0]])).rstrip()
+ self.errors.append(Error(msg, file, details))
for file in sorted(changed_files - mentioned_files):
if not self.in_ignored_location(file):
if file in self.new_files: