mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-08 16:14:26 +00:00
upload: add --draft option.
Change-Id: I6967ff2f8163cd4116027b3f15ddb36875942af4
This commit is contained in:
parent
e8f75fa368
commit
435370c6f0
16
project.py
16
project.py
@ -176,10 +176,11 @@ class ReviewableBranch(object):
|
|||||||
R_HEADS + self.name,
|
R_HEADS + self.name,
|
||||||
'--')
|
'--')
|
||||||
|
|
||||||
def UploadForReview(self, people, auto_topic=False):
|
def UploadForReview(self, people, auto_topic=False, draft=False):
|
||||||
self.project.UploadForReview(self.name,
|
self.project.UploadForReview(self.name,
|
||||||
people,
|
people,
|
||||||
auto_topic=auto_topic)
|
auto_topic=auto_topic,
|
||||||
|
draft=draft)
|
||||||
|
|
||||||
def GetPublishedRefs(self):
|
def GetPublishedRefs(self):
|
||||||
refs = {}
|
refs = {}
|
||||||
@ -881,7 +882,8 @@ class Project(object):
|
|||||||
|
|
||||||
def UploadForReview(self, branch=None,
|
def UploadForReview(self, branch=None,
|
||||||
people=([],[]),
|
people=([],[]),
|
||||||
auto_topic=False):
|
auto_topic=False,
|
||||||
|
draft=False):
|
||||||
"""Uploads the named branch for code review.
|
"""Uploads the named branch for code review.
|
||||||
"""
|
"""
|
||||||
if branch is None:
|
if branch is None:
|
||||||
@ -920,7 +922,13 @@ class Project(object):
|
|||||||
|
|
||||||
if dest_branch.startswith(R_HEADS):
|
if dest_branch.startswith(R_HEADS):
|
||||||
dest_branch = dest_branch[len(R_HEADS):]
|
dest_branch = dest_branch[len(R_HEADS):]
|
||||||
ref_spec = '%s:refs/for/%s' % (R_HEADS + branch.name, dest_branch)
|
|
||||||
|
upload_type = 'for'
|
||||||
|
if draft:
|
||||||
|
upload_type = 'drafts'
|
||||||
|
|
||||||
|
ref_spec = '%s:refs/%s/%s' % (R_HEADS + branch.name, upload_type,
|
||||||
|
dest_branch)
|
||||||
if auto_topic:
|
if auto_topic:
|
||||||
ref_spec = ref_spec + '/' + branch.name
|
ref_spec = ref_spec + '/' + branch.name
|
||||||
cmd.append(ref_spec)
|
cmd.append(ref_spec)
|
||||||
|
@ -134,6 +134,9 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
p.add_option('--cbr', '--current-branch',
|
p.add_option('--cbr', '--current-branch',
|
||||||
dest='current_branch', action='store_true',
|
dest='current_branch', action='store_true',
|
||||||
help='Upload current git branch.')
|
help='Upload current git branch.')
|
||||||
|
p.add_option('-d', '--draft',
|
||||||
|
action='store_true', dest='draft', default=False,
|
||||||
|
help='If specified, upload as a draft.')
|
||||||
|
|
||||||
# Options relating to upload hook. Note that verify and no-verify are NOT
|
# Options relating to upload hook. Note that verify and no-verify are NOT
|
||||||
# opposites of each other, which is why they store to different locations.
|
# opposites of each other, which is why they store to different locations.
|
||||||
@ -324,7 +327,7 @@ Gerrit Code Review: http://code.google.com/p/gerrit/
|
|||||||
key = 'review.%s.uploadtopic' % branch.project.remote.review
|
key = 'review.%s.uploadtopic' % branch.project.remote.review
|
||||||
opt.auto_topic = branch.project.config.GetBoolean(key)
|
opt.auto_topic = branch.project.config.GetBoolean(key)
|
||||||
|
|
||||||
branch.UploadForReview(people, auto_topic=opt.auto_topic)
|
branch.UploadForReview(people, auto_topic=opt.auto_topic, draft=opt.draft)
|
||||||
branch.uploaded = True
|
branch.uploaded = True
|
||||||
except UploadError, e:
|
except UploadError, e:
|
||||||
branch.error = e
|
branch.error = e
|
||||||
|
Loading…
Reference in New Issue
Block a user