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 <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
diff --git a/gerrit_client.py b/gerrit_client.py
index c1e370b..1249f10 100755
--- a/gerrit_client.py
+++ b/gerrit_client.py
@@ -237,6 +237,23 @@
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."""