From f9648b5c7cf801b45bbdc0bf2d7dc71e4f047584 Mon Sep 17 00:00:00 2001 From: Andrii Shyshkalov Date: Wed, 21 Feb 2018 22:32:42 -0800 Subject: [PATCH] git cl try: support custom --category. Over last two weeks of running tryjobs on CLs of others, I found this very useful. This CL also simplifies code. R=agable@chromium.org Change-Id: I5c7ce0d311b1ca024b92227dbec54e5197205c62 Reviewed-on: https://chromium-review.googlesource.com/930742 Reviewed-by: Aaron Gable Commit-Queue: Andrii Shyshkalov --- git_cl.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git_cl.py b/git_cl.py index c9ec13cea..52c9ddffb 100755 --- a/git_cl.py +++ b/git_cl.py @@ -426,8 +426,7 @@ def _get_bucket_map_for_builders(builders): return bucket_map, None -def _trigger_try_jobs(auth_config, changelist, buckets, options, - category='git_cl_try', patchset=None): +def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset): """Sends a request to Buildbucket to trigger try jobs for a changelist. Args: @@ -457,7 +456,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options, patch=patchset) shared_parameters_properties = changelist.GetTryJobProperties(patchset) - shared_parameters_properties['category'] = category + shared_parameters_properties['category'] = options.category if options.clobber: shared_parameters_properties['clobber'] = True extra_properties = _get_properties_from_options(options) @@ -5540,6 +5539,8 @@ def CMDtry(parser, args): '-c', '--clobber', action='store_true', default=False, help='Force a clobber before building; that is don\'t do an ' 'incremental build') + group.add_option( + '--category', default='git_cl_try', help='Specify custom build category.') group.add_option( '--project', help='Override which project to use. Projects are defined ' @@ -5619,8 +5620,7 @@ def CMDtry(parser, args): (patchset, cl.GetPatchset(), patchset)) try: - _trigger_try_jobs(auth_config, cl, buckets, options, 'git_cl_try', - patchset) + _trigger_try_jobs(auth_config, cl, buckets, options, patchset) except BuildbucketResponseException as ex: print('ERROR: %s' % ex) return 1