From 6ec7cd87ac615c693a09a205264ee30d390f9f6d Mon Sep 17 00:00:00 2001 From: Xinan Lin Date: Wed, 21 Jul 2021 00:53:42 +0000 Subject: [PATCH] Add CMDsubmitchange to gerrit_client Grant the power to gerrit_client cmd to submit a change. Once we create a change and update it via CMDchangeedit, we can submit it if the service account has permission. BUG=1207955 TEST=e2e Change-Id: Ia3102641ffe5bb72f8f63ad80bf15b5478cf5a2a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3039331 Reviewed-by: Dirk Pranke Reviewed-by: Michael Moss Commit-Queue: Xinan Lin --- gerrit_client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gerrit_client.py b/gerrit_client.py index c1e370b066..1249f10fa6 100755 --- a/gerrit_client.py +++ b/gerrit_client.py @@ -237,6 +237,23 @@ def CMDpublishchangeedit(parser, args): write_result(result, opt) +@subcommand.usage('[args ...]') +def CMDsubmitchange(parser, args): + """Submit a Gerrit change.""" + parser.add_option('-c', '--change', type=int, help='change number') + parser.add_option('--wait-for-merge', + action="store_true", + default=False, + help='whether to wait for the merge') + + (opt, args) = parser.parse_args(args) + result = gerrit_util.SubmitChange(urlparse.urlparse(opt.host).netloc, + opt.change, + wait_for_merge=opt.wait_for_merge) + logging.info(result) + write_result(result, opt) + + @subcommand.usage('') def CMDabandon(parser, args): """Abandons a Gerrit change."""