Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Support --push-option in upload subcommand
Browse files Browse the repository at this point in the history
Change-Id: I44836f8c66ded5a96cbf5431912e027e681f6529
  • Loading branch information
draftcode committed Nov 13, 2017
1 parent 84e7e16 commit 305a2d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 10 additions & 3 deletions project.py
Expand Up @@ -180,15 +180,17 @@ def UploadForReview(self, people,
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,
draft=draft,
private=private,
wip=wip,
dest_branch=dest_branch,
validate_certs=validate_certs)
validate_certs=validate_certs,
push_options=push_options)

def GetPublishedRefs(self):
refs = {}
Expand Down Expand Up @@ -1117,7 +1119,8 @@ def UploadForReview(self, branch=None,
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:
Expand Down Expand Up @@ -1155,6 +1158,10 @@ def UploadForReview(self, branch=None,
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):
Expand Down
7 changes: 6 additions & 1 deletion subcmds/upload.py
Expand Up @@ -160,6 +160,10 @@ def _Options(self, p):
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',
Expand Down Expand Up @@ -393,7 +397,8 @@ def _UploadAndReport(self, opt, todo, original_people):
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:
Expand Down

0 comments on commit 305a2d0

Please sign in to comment.