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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 self, issue, patchset, reason, clobber, revision, builders_and_tests): | 308 self, issue, patchset, reason, clobber, revision, builders_and_tests): |
309 """Requests new try jobs. | 309 """Requests new try jobs. |
310 | 310 |
311 |builders_and_tests| is a map of builders: [tests] to run. | 311 |builders_and_tests| is a map of builders: [tests] to run. |
312 | 312 |
313 Returns the keys of the new TryJobResult entites. | 313 Returns the keys of the new TryJobResult entites. |
314 """ | 314 """ |
315 params = [ | 315 params = [ |
316 ('reason', reason), | 316 ('reason', reason), |
317 ('clobber', 'True' if clobber else 'False'), | 317 ('clobber', 'True' if clobber else 'False'), |
318 ('revision', revision if revision else 'HEAD'), | |
319 ('builders', json.dumps(builders_and_tests)), | 318 ('builders', json.dumps(builders_and_tests)), |
320 ('xsrf_token', self.xsrf_token()), | 319 ('xsrf_token', self.xsrf_token()), |
321 ] | 320 ] |
| 321 if revision: |
| 322 params.append(('revision', revision)) |
322 return self.post('/%d/try/%d' % (issue, patchset), params) | 323 return self.post('/%d/try/%d' % (issue, patchset), params) |
323 | 324 |
324 def get_pending_try_jobs(self, cursor=None, limit=100): | 325 def get_pending_try_jobs(self, cursor=None, limit=100): |
325 """Retrieves the try job requests in pending state. | 326 """Retrieves the try job requests in pending state. |
326 | 327 |
327 Returns a tuple of the list of try jobs and the cursor for the next request. | 328 Returns a tuple of the list of try jobs and the cursor for the next request. |
328 """ | 329 """ |
329 url = '/get_pending_try_patchsets?limit=%d' % limit | 330 url = '/get_pending_try_patchsets?limit=%d' % limit |
330 extra = ('&cursor=' + cursor) if cursor else '' | 331 extra = ('&cursor=' + cursor) if cursor else '' |
331 data = json.loads(self.get(url + extra)) | 332 data = json.loads(self.get(url + extra)) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if not 'Name or service not known' in e.reason: | 374 if not 'Name or service not known' in e.reason: |
374 # Usually internal GAE flakiness. | 375 # Usually internal GAE flakiness. |
375 raise | 376 raise |
376 # If reaching this line, loop again. Uses a small backoff. | 377 # If reaching this line, loop again. Uses a small backoff. |
377 time.sleep(1+maxtries*2) | 378 time.sleep(1+maxtries*2) |
378 finally: | 379 finally: |
379 upload.ErrorExit = old_error_exit | 380 upload.ErrorExit = old_error_exit |
380 | 381 |
381 # DEPRECATED. | 382 # DEPRECATED. |
382 Send = get | 383 Send = get |
OLD | NEW |