| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """An interface to git-cl. | 5 """An interface to git-cl. |
| 6 | 6 |
| 7 The git-cl tool is responsible for communicating with Rietveld, Gerrit, | 7 The git-cl tool is responsible for communicating with Rietveld, Gerrit, |
| 8 and Buildbucket to manage changelists and try jobs associated with them. | 8 and Buildbucket to manage changelists and try jobs associated with them. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 def fetch_try_results(self): | 62 def fetch_try_results(self): |
| 63 """Requests results of try jobs for the current CL.""" | 63 """Requests results of try jobs for the current CL.""" |
| 64 with self._host.filesystem.mkdtemp() as temp_directory: | 64 with self._host.filesystem.mkdtemp() as temp_directory: |
| 65 results_path = self._host.filesystem.join(temp_directory, 'try-resul
ts.json') | 65 results_path = self._host.filesystem.join(temp_directory, 'try-resul
ts.json') |
| 66 self.run(['try-results', '--json', results_path]) | 66 self.run(['try-results', '--json', results_path]) |
| 67 contents = self._host.filesystem.read_text_file(results_path) | 67 contents = self._host.filesystem.read_text_file(results_path) |
| 68 _log.debug('Fetched try results to file "%s".', results_path) | 68 _log.debug('Fetched try results to file "%s".', results_path) |
| 69 self._host.filesystem.remove(results_path) | 69 self._host.filesystem.remove(results_path) |
| 70 return json.loads(contents) | 70 return json.loads(contents) |
| 71 | 71 |
| 72 def is_closed(self): |
| 73 out = self.run(['status' '--field', 'status']) |
| 74 return out.strip() == 'closed' |
| 75 |
| 72 @staticmethod | 76 @staticmethod |
| 73 def all_jobs_finished(try_results): | 77 def all_jobs_finished(try_results): |
| 74 return all(r.get('status') == 'COMPLETED' for r in try_results) | 78 return all(r.get('status') == 'COMPLETED' for r in try_results) |
| 75 | 79 |
| 76 @staticmethod | 80 @staticmethod |
| 77 def has_failing_try_results(try_results): | 81 def has_failing_try_results(try_results): |
| 78 return any(r.get('result') == 'FAILURE' for r in try_results) | 82 return any(r.get('result') == 'FAILURE' for r in try_results) |
| OLD | NEW |