| OLD | NEW |
| 1 # coding=utf8 | 1 # coding=utf8 |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 """Commit queue manager class. | 5 """Commit queue manager class. |
| 6 | 6 |
| 7 Security implications: | 7 Security implications: |
| 8 | 8 |
| 9 The following hypothesis are made: | 9 The following hypothesis are made: |
| 10 - Commit queue: | 10 - Commit queue: |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 except base.DiscardPending, e: | 195 except base.DiscardPending, e: |
| 196 self._discard_pending(e.pending, e.message) | 196 self._discard_pending(e.pending, e.message) |
| 197 except Exception, e: | 197 except Exception, e: |
| 198 send_stack(e) | 198 send_stack(e) |
| 199 self._discard_pending(pending, 'Commit queue had an internal error') | 199 self._discard_pending(pending, 'Commit queue had an internal error') |
| 200 | 200 |
| 201 def _validity_checks(self, pending): | 201 def _validity_checks(self, pending): |
| 202 """Returns True if this pending is worth looking at.""" | 202 """Returns True if this pending is worth looking at.""" |
| 203 if not any(re.match(r, pending.base_url) for r in self.project_bases): | 203 if not any(re.match(r, pending.base_url) for r in self.project_bases): |
| 204 # Not a repository managed by this instance, silently ignore. | 204 # Not a repository managed by this instance, silently ignore. |
| 205 logging.info('%s not in whitelist' % pending.base_url) |
| 205 return False | 206 return False |
| 206 | 207 |
| 207 if any(re.match(r, pending.owner) for r in self.author_white_list): | 208 if any(re.match(r, pending.owner) for r in self.author_white_list): |
| 208 # Can't commit because the owner is not on the whitelist. | 209 # Can't commit because the owner is not on the whitelist. |
| 210 logging.info('%s not in whitelist' % pending.owner) |
| 209 return False | 211 return False |
| 210 | 212 |
| 211 # Need at least one reviewer matching at least one regexp in | 213 # Need at least one reviewer matching at least one regexp in |
| 212 # self.reviewers that is not also the owner of the issue. | 214 # self.reviewers that is not also the owner of the issue. |
| 213 def match_reviewer(reviewer): | 215 def match_reviewer(reviewer): |
| 214 return any(re.match(reviewer_regexp, reviewer) | 216 return any(re.match(reviewer_regexp, reviewer) |
| 215 for reviewer_regexp in self.reviewers) | 217 for reviewer_regexp in self.reviewers) |
| 216 | 218 |
| 217 if not any(match_reviewer(reviewer) for reviewer in pending.reviewers | 219 if not any(match_reviewer(reviewer) for reviewer in pending.reviewers |
| 218 if not reviewer == pending.owner): | 220 if not reviewer == pending.owner): |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 'Patch failed to apply against %s.' % revision) | 276 'Patch failed to apply against %s.' % revision) |
| 275 | 277 |
| 276 def load(self, filename): | 278 def load(self, filename): |
| 277 """Loads the commit queue state from a JSON file.""" | 279 """Loads the commit queue state from a JSON file.""" |
| 278 self.queue = model.load_from_json_file(filename) | 280 self.queue = model.load_from_json_file(filename) |
| 279 self.queue.pending_commits = self.queue.pending_commits or [] | 281 self.queue.pending_commits = self.queue.pending_commits or [] |
| 280 | 282 |
| 281 def save(self, filename): | 283 def save(self, filename): |
| 282 """Save the commit queue state in a simple JSON file.""" | 284 """Save the commit queue state in a simple JSON file.""" |
| 283 model.save_to_json_file(filename, self.queue) | 285 model.save_to_json_file(filename, self.queue) |
| OLD | NEW |