Commit 0b0738d9 authored by Xinan Lin's avatar Xinan Lin Committed by LUCI CQ

Add setbotcommit method to gerrit_client

This is required if we want to land a bot-generated-cl.

BUG=1207955
TEST=e2e

Change-Id: Ib758b9782f9951a3ec23ce9970b0db2a48b1b5f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3049573
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
Reviewed-by: 's avatarMichael Moss <mmoss@chromium.org>
parent 2eba5297
......@@ -265,6 +265,20 @@ def CMDgetcommitincludedin(parser, args):
write_result(result, opt)
@subcommand.usage('[args ...]')
def CMDsetbotcommit(parser, args):
"""Sets bot-commit+1 to a bot generated change."""
parser.add_option('-c', '--change', type=int, help='change number')
(opt, args) = parser.parse_args(args)
result = gerrit_util.SetReview(
urlparse.urlparse(opt.host).netloc,
opt.change,
labels={'Bot-Commit': 1},
ready=True)
logging.info(result)
write_result(result, opt)
@subcommand.usage('')
def CMDabandon(parser, args):
"""Abandons a Gerrit change."""
......
......@@ -921,7 +921,7 @@ def SetReview(host, change, msg=None, labels=None, notify=None, ready=None):
int(response['labels'][key] != int(val))):
raise GerritError(200, 'Unable to set "%s" label on change %s.' % (
key, change))
return response
def ResetReviewLabels(host, change, label, value='0', message=None,
notify=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment