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 <agable@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index c9ec13c..52c9ddf 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -426,8 +426,7 @@
   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 @@
       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)
@@ -5541,6 +5540,8 @@
       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 '
            'in recipe to determine to which repository or directory to '
@@ -5619,8 +5620,7 @@
           (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