help='Path to git repository')
parser.add_argument('-p', '--print-changelog', action='store_true',
help='Print final changelog entires')
+parser.add_argument('-v', '--verbose', action='store_true',
+ help='Print verbose information')
args = parser.parse_args()
retval = 0
else:
for error in git_commit.errors:
print('ERR: %s' % error)
+ if args.verbose and error.details:
+ print(error.details)
retval = 1
exit(retval)
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
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: