From b95e3b5f8d2f58bc316d0de3c04fd5094baa5df3 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 14 Aug 2014 13:40:35 +0400 Subject: [PATCH] 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 --- elastic_recheck/elasticRecheck.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/elastic_recheck/elasticRecheck.py b/elastic_recheck/elasticRecheck.py index 58ce1ec5..037026a1 100644 --- a/elastic_recheck/elasticRecheck.py +++ b/elastic_recheck/elasticRecheck.py @@ -329,15 +329,17 @@ class Stream(object): return fevent def leave_comment(self, event, msgs, debug=False): + parts = [] 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(): - msg += msgs['recheck_instructions'] + parts.append(msgs['recheck_instructions']) else: - msg += msgs['unrecognized'] - msg += msgs['footer'] + parts.append(msgs['unrecognized']) + parts.append(msgs['footer']) 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" % (event.name(), msg)) if not debug: