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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 message = message[:max_message-len(tail)] + tail | 246 message = message[:max_message-len(tail)] + tail |
247 logging.info('issue %d; comment: %s' % (issue, message.strip()[:300])) | 247 logging.info('issue %d; comment: %s' % (issue, message.strip()[:300])) |
248 return self.post('/%d/publish' % issue, [ | 248 return self.post('/%d/publish' % issue, [ |
249 ('xsrf_token', self.xsrf_token()), | 249 ('xsrf_token', self.xsrf_token()), |
250 ('message', message), | 250 ('message', message), |
251 ('message_only', 'True'), | 251 ('message_only', 'True'), |
252 ('add_as_reviewer', str(bool(add_as_reviewer))), | 252 ('add_as_reviewer', str(bool(add_as_reviewer))), |
253 ('send_mail', 'True'), | 253 ('send_mail', 'True'), |
254 ('no_redirect', 'True')]) | 254 ('no_redirect', 'True')]) |
255 | 255 |
| 256 def add_inline_comment( |
| 257 self, issue, text, side, snapshot, patchset, patchid, lineno): |
| 258 logging.info('add inline comment for issue %d' % issue) |
| 259 return self.post('/inline_draft', [ |
| 260 ('issue', str(issue)), |
| 261 ('text', text), |
| 262 ('side', side), |
| 263 ('snapshot', snapshot), |
| 264 ('patchset', str(patchset)), |
| 265 ('patch', str(patchid)), |
| 266 ('lineno', str(lineno))]) |
| 267 |
256 def set_flag(self, issue, patchset, flag, value): | 268 def set_flag(self, issue, patchset, flag, value): |
257 return self.post('/%d/edit_flags' % issue, [ | 269 return self.post('/%d/edit_flags' % issue, [ |
258 ('last_patchset', str(patchset)), | 270 ('last_patchset', str(patchset)), |
259 ('xsrf_token', self.xsrf_token()), | 271 ('xsrf_token', self.xsrf_token()), |
260 (flag, str(value))]) | 272 (flag, str(value))]) |
261 | 273 |
262 def search( | 274 def search( |
263 self, | 275 self, |
264 owner=None, reviewer=None, | 276 owner=None, reviewer=None, |
265 base=None, | 277 base=None, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 526 |
515 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 | 527 def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 |
516 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % | 528 logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % |
517 (flag, value, issue)) | 529 (flag, value, issue)) |
518 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value | 530 ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value |
519 | 531 |
520 def trigger_try_jobs( # pylint:disable=R0201 | 532 def trigger_try_jobs( # pylint:disable=R0201 |
521 self, issue, patchset, reason, clobber, revision, builders_and_tests): | 533 self, issue, patchset, reason, clobber, revision, builders_and_tests): |
522 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % | 534 logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % |
523 (builders_and_tests, issue)) | 535 (builders_and_tests, issue)) |
OLD | NEW |