Enable specification of author email in push-to-trunk.

If not specified, depot tools tend to ask for an email on the command line once in a while, which makes the automated script hang.

BUG=
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/158733002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19223 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
machenbach@chromium.org 2014-02-10 12:48:36 +00:00
parent b618d2a42a
commit e81eacfa74
4 changed files with 31 additions and 11 deletions

View File

@ -55,6 +55,7 @@ class AutoRollOptions(CommonOptions):
self.r = options.r
self.c = options.c
self.push = getattr(options, 'push', False)
self.author = getattr(options, 'a', None)
class Preparation(Step):
@ -154,14 +155,14 @@ class PushToTrunk(Step):
print "ToT (r%d) is clean. Pushing to trunk." % latest
self.PushTreeStatus("Tree is closed (preparing to push)")
# TODO(machenbach): Call push to trunk script.
# TODO(machenbach): Update the script before calling it.
try:
if self._options.push:
self._side_effect_handler.Call(
RunPushToTrunk,
push_to_trunk.CONFIG,
PushToTrunkOptions.MakeForcedOptions(self._options.r,
PushToTrunkOptions.MakeForcedOptions(self._options.author,
self._options.r,
self._options.c),
self._side_effect_handler)
finally:
@ -188,6 +189,8 @@ def RunAutoRoll(config,
def BuildOptions():
result = optparse.OptionParser()
result.add_option("-a", "--author", dest="a",
help=("Specify the author email used for rietveld."))
result.add_option("-c", "--chromium", dest="c",
help=("Specify the path to your Chromium src/ "
"directory to automate the V8 roll."))
@ -207,8 +210,8 @@ def BuildOptions():
def Main():
parser = BuildOptions()
(options, args) = parser.parse_args()
if not options.c or not options.r:
print "You need to specify the chromium src location and a reviewer."
if not options.a or not options.c or not options.r:
print "You need to specify author, chromium src location and reviewer."
parser.print_help()
return 1
RunAutoRoll(CONFIG, AutoRollOptions(options))

View File

@ -227,6 +227,7 @@ class CommonOptions(object):
self.force_readline_defaults = not manual
self.force_upload = not manual
self.manual = manual
self.author = getattr(options, 'a', None)
class Step(object):
@ -468,8 +469,11 @@ class UploadStep(Step):
print "Please enter the email address of a V8 reviewer for your patch: ",
self.DieNoManualMode("A reviewer must be specified in forced mode.")
reviewer = self.ReadLine()
author_option = self._options.author
author = " --email \"%s\"" % author_option if author_option else ""
force_flag = " -f" if self._options.force_upload else ""
args = "cl upload -r \"%s\" --send-mail%s" % (reviewer, force_flag)
args = ("cl upload%s -r \"%s\" --send-mail%s"
% (author, reviewer, force_flag))
# TODO(machenbach): Check output in forced mode. Verify that all required
# base files were uploaded, if not retry.
if self.Git(args, pipe=False) is None:

View File

@ -54,7 +54,7 @@ CONFIG = {
class PushToTrunkOptions(CommonOptions):
@staticmethod
def MakeForcedOptions(reviewer, chrome_path):
def MakeForcedOptions(author, reviewer, chrome_path):
"""Convenience wrapper."""
class Options(object):
pass
@ -65,6 +65,7 @@ class PushToTrunkOptions(CommonOptions):
options.m = False
options.r = reviewer
options.c = chrome_path
options.a = author
return PushToTrunkOptions(options)
def __init__(self, options):
@ -75,6 +76,7 @@ class PushToTrunkOptions(CommonOptions):
self.l = options.l
self.r = options.r
self.c = options.c
self.author = getattr(options, 'a', None)
class Preparation(Step):
MESSAGE = "Preparation."
@ -492,8 +494,11 @@ class UploadCL(Step):
% (ver, self._state["svn_revision"], rev))
if self.Git(args) is None:
self.Die("'git commit' failed.")
author_option = self._options.author
author = " --email \"%s\"" % author_option if author_option else ""
force_flag = " -f" if self._options.force_upload else ""
if self.Git("cl upload --send-mail%s" % force_flag, pipe=False) is None:
if self.Git("cl upload%s --send-mail%s" % (author, force_flag),
pipe=False) is None:
self.Die("'git cl upload' failed, please try again.")
print "CL uploaded."
@ -568,6 +573,8 @@ def RunPushToTrunk(config,
def BuildOptions():
result = optparse.OptionParser()
result.add_option("-a", "--author", dest="a",
help=("Specify the author email used for rietveld."))
result.add_option("-c", "--chromium", dest="c",
help=("Specify the path to your Chromium src/ "
"directory to automate the V8 roll."))
@ -601,6 +608,9 @@ def ProcessOptions(options):
if not options.m and not options.c:
print "A chromium checkout (-c) is required in (semi-)automatic mode."
return False
if not options.m and not options.a:
print "Specify your chromium.org email with -a in (semi-)automatic mode."
return False
return True

View File

@ -59,7 +59,7 @@ TEST_CONFIG = {
}
def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None,
def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None, a=None,
status_password=None):
"""Convenience wrapper."""
class Options(object):
@ -71,6 +71,7 @@ def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None,
options.m = m
options.r = r
options.c = c
options.a = a
options.status_password = status_password
return options
@ -673,7 +674,8 @@ Performance and stability improvements on all platforms.""", commit)
"Now working on version 3.22.6.%s\"" % review_suffix),
" 2 files changed\n",
CheckPreparePush],
["cl upload -r \"reviewer@chromium.org\" --send-mail%s" % force_flag,
[("cl upload --email \"author@chromium.org\" "
"-r \"reviewer@chromium.org\" --send-mail%s" % force_flag),
"done\n"],
["cl presubmit", "Presubmit successfull\n"],
["cl dcommit -f --bypass-hooks", "Closing issue\n"],
@ -698,7 +700,8 @@ Performance and stability improvements on all platforms.""", commit)
"(based on bleeding_edge revision r123455).\n\n"
"TBR=reviewer@chromium.org\""),
""],
["cl upload --send-mail%s" % force_flag, ""],
["cl upload --email \"author@chromium.org\" --send-mail%s" % force_flag,
""],
["checkout -f some_branch", ""],
["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""],
["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""],
@ -728,7 +731,7 @@ Performance and stability improvements on all platforms.""", commit)
if force:
self.ExpectReadline([])
options = MakeOptions(f=force, m=manual,
options = MakeOptions(f=force, m=manual, a="author@chromium.org",
r="reviewer@chromium.org" if not manual else None,
c = TEST_CONFIG[CHROMIUM])
RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self)