ReviewBot: comment_write(): include target in debug message when too similar.

This commit is contained in:
Jimmy Berry 2017-08-04 13:32:07 -05:00
parent 737273c38f
commit 9443c3de04

View File

@ -446,15 +446,16 @@ class ReviewBot(object):
comments = self.comment_api.get_comments(**kwargs)
comment, _ = self.comment_api.comment_find(comments, self.bot_name, info)
debug_key = '/'.join(kwargs.values())
if (comment is not None and
((identical and comment['comment'] == message) or
(not identical and comment['comment'].count('\n') == message.count('\n')))
):
# Assume same state/result and number of lines in message is duplicate.
self.logger.debug('previous comment too similar to bother commenting again')
self.logger.debug('previous comment on {} too similar'.format(debug_key))
return
self.logger.debug('adding comment to {}: {}'.format('/'.join(kwargs.values()), message))
self.logger.debug('adding comment to {}: {}'.format(debug_key, message))
if not self.dryrun:
if comment is None: