Force newline after each part of comment message

This would force a whitespace between message parts so that for
example URL at the end of 'unrecognized' part won't get joined with
first word of 'footer'.

This change also fixes hidden (I guess) bug that should've been
producing UnboundLocalError if FailedEvent.get_all_bugs() returns None.

Change-Id: I3a44db0b7018c49f87702d900961ea7119081b12
This commit is contained in:
Yuriy Taraday 2014-08-14 13:40:35 +04:00
parent 059137aec0
commit b95e3b5f8d

View File

@ -329,15 +329,17 @@ class Stream(object):
return fevent return fevent
def leave_comment(self, event, msgs, debug=False): def leave_comment(self, event, msgs, debug=False):
parts = []
if event.get_all_bugs(): if event.get_all_bugs():
msg = msgs['found_bug'] % {'bugs': event.bug_list()} parts.append(msgs['found_bug'] % {'bugs': event.bug_list()})
if event.is_fully_classified(): if event.is_fully_classified():
msg += msgs['recheck_instructions'] parts.append(msgs['recheck_instructions'])
else: else:
msg += msgs['unrecognized'] parts.append(msgs['unrecognized'])
msg += msgs['footer'] parts.append(msgs['footer'])
else: else:
msg += msgs['no_bugs_found'] parts.append(msgs['no_bugs_found'])
msg = '\n'.join(parts)
self.log.debug("Compiled comment for commit %s:\n%s" % self.log.debug("Compiled comment for commit %s:\n%s" %
(event.name(), msg)) (event.name(), msg))
if not debug: if not debug: