OLD | NEW |
1 # coding=utf8 | 1 # coding=utf8 |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 raise base.DiscardPending(pending, | 398 raise base.DiscardPending(pending, |
399 'Commit queue failed due to new patchset.') | 399 'Commit queue failed due to new patchset.') |
400 | 400 |
401 def _discard_pending(self, pending, message): | 401 def _discard_pending(self, pending, message): |
402 """Discards a pending commit. Attach an optional message to the review.""" | 402 """Discards a pending commit. Attach an optional message to the review.""" |
403 logging.debug('_discard_pending(%s, %s)', pending.issue, message) | 403 logging.debug('_discard_pending(%s, %s)', pending.issue, message) |
404 try: | 404 try: |
405 try: | 405 try: |
406 if pending.get_state() != base.IGNORED: | 406 if pending.get_state() != base.IGNORED: |
407 self.context.rietveld.set_flag( | 407 self.context.rietveld.set_flag( |
408 pending.issue, pending.patchset, 'commit', 'False') | 408 pending.issue, pending.patchset, 'commit', False) |
409 except urllib2.HTTPError as e: | 409 except urllib2.HTTPError as e: |
410 logging.error( | 410 logging.error( |
411 'Failed to set the flag to False for %s with message %s' % ( | 411 'Failed to set the flag to False for %s with message %s' % ( |
412 pending.pending_name(), message)) | 412 pending.pending_name(), message)) |
413 traceback.print_stack() | 413 traceback.print_stack() |
414 errors.send_stack(e) | 414 errors.send_stack(e) |
415 if message: | 415 if message: |
416 try: | 416 try: |
417 self.context.rietveld.add_comment(pending.issue, message) | 417 self.context.rietveld.add_comment(pending.issue, message) |
418 except urllib2.HTTPError as e: | 418 except urllib2.HTTPError as e: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 """Loads the commit queue state from a JSON file.""" | 542 """Loads the commit queue state from a JSON file.""" |
543 self.queue = model.load_from_json_file(filename) | 543 self.queue = model.load_from_json_file(filename) |
544 | 544 |
545 def save(self, filename): | 545 def save(self, filename): |
546 """Save the commit queue state in a simple JSON file.""" | 546 """Save the commit queue state in a simple JSON file.""" |
547 model.save_to_json_file(filename, self.queue) | 547 model.save_to_json_file(filename, self.queue) |
548 | 548 |
549 def close(self): | 549 def close(self): |
550 """Close all the active pending manager items.""" | 550 """Close all the active pending manager items.""" |
551 self.context.status.close() | 551 self.context.status.close() |
OLD | NEW |