| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 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 """Defines class Rietveld to easily access a rietveld instance. | 5 """Defines class Rietveld to easily access a rietveld instance. |
| 6 | 6 |
| 7 Security implications: | 7 Security implications: |
| 8 | 8 |
| 9 The following hypothesis are made: | 9 The following hypothesis are made: |
| 10 - Rietveld enforces: | 10 - Rietveld enforces: |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 url += '?messages=true' | 82 url += '?messages=true' |
| 83 data = json.loads(self.get(url, retry_on_404=True)) | 83 data = json.loads(self.get(url, retry_on_404=True)) |
| 84 data['description'] = '\n'.join(data['description'].strip().splitlines()) | 84 data['description'] = '\n'.join(data['description'].strip().splitlines()) |
| 85 return data | 85 return data |
| 86 | 86 |
| 87 def get_depends_on_patchset(self, issue, patchset): | 87 def get_depends_on_patchset(self, issue, patchset): |
| 88 """Returns the patchset this patchset depends on if it exists.""" | 88 """Returns the patchset this patchset depends on if it exists.""" |
| 89 url = '/%d/patchset/%d/get_depends_on_patchset' % (issue, patchset) | 89 url = '/%d/patchset/%d/get_depends_on_patchset' % (issue, patchset) |
| 90 resp = None | 90 resp = None |
| 91 try: | 91 try: |
| 92 resp = json.loads(self.get(url)) | 92 resp = json.loads(self.post(url, [])) |
| 93 except (urllib2.HTTPError, ValueError): | 93 except (urllib2.HTTPError, ValueError): |
| 94 # The get_depends_on_patchset endpoint does not exist on this Rietveld | 94 # The get_depends_on_patchset endpoint does not exist on this Rietveld |
| 95 # instance yet. Ignore the error and proceed. | 95 # instance yet. Ignore the error and proceed. |
| 96 # TODO(rmistry): Make this an error when all Rietveld instances have | 96 # TODO(rmistry): Make this an error when all Rietveld instances have |
| 97 # this endpoint. | 97 # this endpoint. |
| 98 pass | 98 pass |
| 99 return resp | 99 return resp |
| 100 | 100 |
| 101 def get_patchset_properties(self, issue, patchset): | 101 def get_patchset_properties(self, issue, patchset): |
| 102 """Returns the patchset properties.""" | 102 """Returns the patchset properties.""" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 self, issue, patchset, reason, clobber, revision, builders_and_tests, | 717 self, issue, patchset, reason, clobber, revision, builders_and_tests, |
| 718 master=None, category='cq'): | 718 master=None, category='cq'): |
| 719 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 719 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
| 720 (builders_and_tests, issue)) | 720 (builders_and_tests, issue)) |
| 721 | 721 |
| 722 def trigger_distributed_try_jobs( # pylint:disable=R0201 | 722 def trigger_distributed_try_jobs( # pylint:disable=R0201 |
| 723 self, issue, patchset, reason, clobber, revision, masters, | 723 self, issue, patchset, reason, clobber, revision, masters, |
| 724 category='cq'): | 724 category='cq'): |
| 725 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 725 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
| 726 (masters, issue)) | 726 (masters, issue)) |
| OLD | NEW |