| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 for red_flag_string in red_flag_strings: | 170 for red_flag_string in red_flag_strings: |
| 171 if line.lower().startswith(red_flag_string.lower()): | 171 if line.lower().startswith(red_flag_string.lower()): |
| 172 red_flags.append(line.strip()) | 172 red_flags.append(line.strip()) |
| 173 | 173 |
| 174 if review_url: | 174 if review_url: |
| 175 match = re.search(r'(?P<review_id>\d+)', review_url) | 175 match = re.search(r'(?P<review_id>\d+)', review_url) |
| 176 if match: | 176 if match: |
| 177 review_url = 'http://crrev.com/%s' % match.group('review_id') | 177 review_url = 'http://crrev.com/%s' % match.group('review_id') |
| 178 first_url = review_url if review_url else 'https://chromium.googlesource
.com/chromium/blink/+/%s' % commit[:8] | 178 first_url = review_url if review_url else 'https://chromium.googlesource
.com/chromium/blink/+/%s' % commit[:8] |
| 179 | 179 |
| 180 red_flag_message = ' \x037%s\x03' % (' '.join(red_flags)) if red_flags e
lse '' | 180 red_flag_message = '\x037%s\x03' % (' '.join(red_flags)) if red_flags el
se '' |
| 181 | 181 |
| 182 return '%s committed "%s" %s %s%s' % (email, subject, first_url, svn_rev
ision, red_flag_message) | 182 return ('%s %s %s committed "%s" %s' % (svn_revision, first_url, email,
subject, red_flag_message)).strip() |
| 183 | 183 |
| 184 def _post(self, message): | 184 def _post(self, message): |
| 185 self.connection.execute_delayed(0, lambda: self.connection.privmsg(chann
el, self._sanitize_string(message))) | 185 self.connection.execute_delayed(0, lambda: self.connection.privmsg(chann
el, self._sanitize_string(message))) |
| 186 | 186 |
| 187 def _sanitize_string(self, message): | 187 def _sanitize_string(self, message): |
| 188 return message.encode('ascii', 'backslashreplace') | 188 return message.encode('ascii', 'backslashreplace') |
| 189 | 189 |
| 190 | 190 |
| 191 class CommitAnnouncerThread(threading.Thread): | 191 class CommitAnnouncerThread(threading.Thread): |
| 192 def __init__(self, tool, irc_password): | 192 def __init__(self, tool, irc_password): |
| 193 threading.Thread.__init__(self) | 193 threading.Thread.__init__(self) |
| 194 self.bot = CommitAnnouncer(tool, irc_password) | 194 self.bot = CommitAnnouncer(tool, irc_password) |
| 195 | 195 |
| 196 def run(self): | 196 def run(self): |
| 197 self.bot.start() | 197 self.bot.start() |
| 198 | 198 |
| 199 def stop(self): | 199 def stop(self): |
| 200 self.bot.stop() | 200 self.bot.stop() |
| 201 self.join() | 201 self.join() |
| OLD | NEW |