From 305a2d029f471d94759da7b304f886723cab6ba5 Mon Sep 17 00:00:00 2001 From: Masaya Suzuki Date: Mon, 13 Nov 2017 10:48:34 -0800 Subject: [PATCH] Support --push-option in upload subcommand Change-Id: I44836f8c66ded5a96cbf5431912e027e681f6529 --- project.py | 13 ++++++++++--- subcmds/upload.py | 7 ++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/project.py b/project.py index e1a844e7..83dcf551 100644 --- a/project.py +++ b/project.py @@ -180,7 +180,8 @@ class ReviewableBranch(object): private=False, wip=False, dest_branch=None, - validate_certs=True): + validate_certs=True, + push_options=None): self.project.UploadForReview(self.name, people, auto_topic=auto_topic, @@ -188,7 +189,8 @@ class ReviewableBranch(object): private=private, wip=wip, dest_branch=dest_branch, - validate_certs=validate_certs) + validate_certs=validate_certs, + push_options=push_options) def GetPublishedRefs(self): refs = {} @@ -1117,7 +1119,8 @@ class Project(object): private=False, wip=False, dest_branch=None, - validate_certs=True): + validate_certs=True, + push_options=None): """Uploads the named branch for code review. """ if branch is None: @@ -1155,6 +1158,10 @@ class Project(object): rp.append('--cc=%s' % sq(e)) cmd.append('--receive-pack=%s' % " ".join(rp)) + for push_option in (push_options or []): + cmd.append('-o') + cmd.append(push_option) + cmd.append(url) if dest_branch.startswith(R_HEADS): diff --git a/subcmds/upload.py b/subcmds/upload.py index 60feff7a..77eaf81a 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -160,6 +160,10 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ p.add_option('-w', '--wip', action='store_true', dest='wip', default=False, help='If specified, upload as a work-in-progress change.') + p.add_option('-o', '--push-option', + type='string', action='append', dest='push_options', + default=[], + help='Additional push options to transmit') p.add_option('-D', '--destination', '--dest', type='string', action='store', dest='dest_branch', metavar='BRANCH', @@ -393,7 +397,8 @@ Gerrit Code Review: http://code.google.com/p/gerrit/ private=opt.private, wip=opt.wip, dest_branch=destination, - validate_certs=opt.validate_certs) + validate_certs=opt.validate_certs, + push_options=opt.push_options) branch.uploaded = True except UploadError as e: