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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 'revision': pending.revision, | 537 'revision': pending.revision, |
538 'output': msg, | 538 'output': msg, |
539 'url': viewvc_url}}) | 539 'url': viewvc_url}}) |
540 | 540 |
541 # Closes the issue on Rietveld. | 541 # Closes the issue on Rietveld. |
542 # TODO(csharp): Retry if exceptions are encountered. | 542 # TODO(csharp): Retry if exceptions are encountered. |
543 try: | 543 try: |
544 self.context.rietveld.close_issue(pending.issue) | 544 self.context.rietveld.close_issue(pending.issue) |
545 self.context.rietveld.update_description( | 545 self.context.rietveld.update_description( |
546 pending.issue, issue_desc.description) | 546 pending.issue, issue_desc.description) |
547 self.context.rietveld.add_comment( | 547 self._discard_pending(pending, |
Paweł Hajdan Jr.
2014/02/03 18:47:34
I think this discard_pending call should be outsid
iannucci
2014/02/03 19:21:32
Yes, but then the Issue won't have the final commi
Sergey Berezin
2014/02/03 19:48:43
Actually, moving _discard_pending() after try...ex
| |
548 pending.issue, 'Change committed as %s' % pending.revision) | 548 'Change committed as %s' % pending.revision) |
549 except (urllib2.HTTPError, urllib2.URLError) as e: | 549 except (urllib2.HTTPError, urllib2.URLError) as e: |
550 # Ignore AppEngine flakiness. | 550 # Ignore AppEngine flakiness. |
551 logging.warning('Unable to fully close the issue') | 551 logging.warning('Unable to fully close the issue') |
552 # And finally remove the issue. If the close_issue() call above failed, | |
553 # it is possible the dashboard will be confused but it is harmless. | |
554 try: | |
555 self.queue.get(pending.issue) | |
556 except KeyError: | |
557 logging.error('Internal inconsistency for %d', pending.issue) | |
558 self.queue.remove(pending.issue) | |
559 except ( | 552 except ( |
560 checkout.PatchApplicationFailed, patch.UnsupportedPatchFormat) as e: | 553 checkout.PatchApplicationFailed, patch.UnsupportedPatchFormat) as e: |
561 raise base.DiscardPending(pending, str(e)) | 554 raise base.DiscardPending(pending, str(e)) |
562 except subprocess2.CalledProcessError as e: | 555 except subprocess2.CalledProcessError as e: |
563 stdout = getattr(e, 'stdout', None) | 556 stdout = getattr(e, 'stdout', None) |
564 out = 'Failed to apply the patch.' | 557 out = 'Failed to apply the patch.' |
565 if stdout: | 558 if stdout: |
566 out += '\n%s' % stdout | 559 out += '\n%s' % stdout |
567 raise base.DiscardPending(pending, out) | 560 raise base.DiscardPending(pending, out) |
568 except base.DiscardPending as e: | 561 except base.DiscardPending as e: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
602 """Loads the commit queue state from a JSON file.""" | 595 """Loads the commit queue state from a JSON file.""" |
603 self.queue = model.load_from_json_file(filename) | 596 self.queue = model.load_from_json_file(filename) |
604 | 597 |
605 def save(self, filename): | 598 def save(self, filename): |
606 """Save the commit queue state in a simple JSON file.""" | 599 """Save the commit queue state in a simple JSON file.""" |
607 model.save_to_json_file(filename, self.queue) | 600 model.save_to_json_file(filename, self.queue) |
608 | 601 |
609 def close(self): | 602 def close(self): |
610 """Close all the active pending manager items.""" | 603 """Close all the active pending manager items.""" |
611 self.context.status.close() | 604 self.context.status.close() |
OLD | NEW |