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
parent b618d2a4
...@@ -55,6 +55,7 @@ class AutoRollOptions(CommonOptions): ...@@ -55,6 +55,7 @@ class AutoRollOptions(CommonOptions):
self.r = options.r self.r = options.r
self.c = options.c self.c = options.c
self.push = getattr(options, 'push', False) self.push = getattr(options, 'push', False)
self.author = getattr(options, 'a', None)
class Preparation(Step): class Preparation(Step):
...@@ -154,14 +155,14 @@ class PushToTrunk(Step): ...@@ -154,14 +155,14 @@ class PushToTrunk(Step):
print "ToT (r%d) is clean. Pushing to trunk." % latest print "ToT (r%d) is clean. Pushing to trunk." % latest
self.PushTreeStatus("Tree is closed (preparing to push)") self.PushTreeStatus("Tree is closed (preparing to push)")
# TODO(machenbach): Call push to trunk script.
# TODO(machenbach): Update the script before calling it. # TODO(machenbach): Update the script before calling it.
try: try:
if self._options.push: if self._options.push:
self._side_effect_handler.Call( self._side_effect_handler.Call(
RunPushToTrunk, RunPushToTrunk,
push_to_trunk.CONFIG, push_to_trunk.CONFIG,
PushToTrunkOptions.MakeForcedOptions(self._options.r, PushToTrunkOptions.MakeForcedOptions(self._options.author,
self._options.r,
self._options.c), self._options.c),
self._side_effect_handler) self._side_effect_handler)
finally: finally:
...@@ -188,6 +189,8 @@ def RunAutoRoll(config, ...@@ -188,6 +189,8 @@ def RunAutoRoll(config,
def BuildOptions(): def BuildOptions():
result = optparse.OptionParser() 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", result.add_option("-c", "--chromium", dest="c",
help=("Specify the path to your Chromium src/ " help=("Specify the path to your Chromium src/ "
"directory to automate the V8 roll.")) "directory to automate the V8 roll."))
...@@ -207,8 +210,8 @@ def BuildOptions(): ...@@ -207,8 +210,8 @@ def BuildOptions():
def Main(): def Main():
parser = BuildOptions() parser = BuildOptions()
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if not options.c or not options.r: if not options.a or not options.c or not options.r:
print "You need to specify the chromium src location and a reviewer." print "You need to specify author, chromium src location and reviewer."
parser.print_help() parser.print_help()
return 1 return 1
RunAutoRoll(CONFIG, AutoRollOptions(options)) RunAutoRoll(CONFIG, AutoRollOptions(options))
......
...@@ -227,6 +227,7 @@ class CommonOptions(object): ...@@ -227,6 +227,7 @@ class CommonOptions(object):
self.force_readline_defaults = not manual self.force_readline_defaults = not manual
self.force_upload = not manual self.force_upload = not manual
self.manual = manual self.manual = manual
self.author = getattr(options, 'a', None)
class Step(object): class Step(object):
...@@ -468,8 +469,11 @@ class UploadStep(Step): ...@@ -468,8 +469,11 @@ class UploadStep(Step):
print "Please enter the email address of a V8 reviewer for your patch: ", print "Please enter the email address of a V8 reviewer for your patch: ",
self.DieNoManualMode("A reviewer must be specified in forced mode.") self.DieNoManualMode("A reviewer must be specified in forced mode.")
reviewer = self.ReadLine() 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 "" 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 # TODO(machenbach): Check output in forced mode. Verify that all required
# base files were uploaded, if not retry. # base files were uploaded, if not retry.
if self.Git(args, pipe=False) is None: if self.Git(args, pipe=False) is None:
......
...@@ -54,7 +54,7 @@ CONFIG = { ...@@ -54,7 +54,7 @@ CONFIG = {
class PushToTrunkOptions(CommonOptions): class PushToTrunkOptions(CommonOptions):
@staticmethod @staticmethod
def MakeForcedOptions(reviewer, chrome_path): def MakeForcedOptions(author, reviewer, chrome_path):
"""Convenience wrapper.""" """Convenience wrapper."""
class Options(object): class Options(object):
pass pass
...@@ -65,6 +65,7 @@ class PushToTrunkOptions(CommonOptions): ...@@ -65,6 +65,7 @@ class PushToTrunkOptions(CommonOptions):
options.m = False options.m = False
options.r = reviewer options.r = reviewer
options.c = chrome_path options.c = chrome_path
options.a = author
return PushToTrunkOptions(options) return PushToTrunkOptions(options)
def __init__(self, options): def __init__(self, options):
...@@ -75,6 +76,7 @@ class PushToTrunkOptions(CommonOptions): ...@@ -75,6 +76,7 @@ class PushToTrunkOptions(CommonOptions):
self.l = options.l self.l = options.l
self.r = options.r self.r = options.r
self.c = options.c self.c = options.c
self.author = getattr(options, 'a', None)
class Preparation(Step): class Preparation(Step):
MESSAGE = "Preparation." MESSAGE = "Preparation."
...@@ -492,8 +494,11 @@ class UploadCL(Step): ...@@ -492,8 +494,11 @@ class UploadCL(Step):
% (ver, self._state["svn_revision"], rev)) % (ver, self._state["svn_revision"], rev))
if self.Git(args) is None: if self.Git(args) is None:
self.Die("'git commit' failed.") 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 "" 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.") self.Die("'git cl upload' failed, please try again.")
print "CL uploaded." print "CL uploaded."
...@@ -568,6 +573,8 @@ def RunPushToTrunk(config, ...@@ -568,6 +573,8 @@ def RunPushToTrunk(config,
def BuildOptions(): def BuildOptions():
result = optparse.OptionParser() 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", result.add_option("-c", "--chromium", dest="c",
help=("Specify the path to your Chromium src/ " help=("Specify the path to your Chromium src/ "
"directory to automate the V8 roll.")) "directory to automate the V8 roll."))
...@@ -601,6 +608,9 @@ def ProcessOptions(options): ...@@ -601,6 +608,9 @@ def ProcessOptions(options):
if not options.m and not options.c: if not options.m and not options.c:
print "A chromium checkout (-c) is required in (semi-)automatic mode." print "A chromium checkout (-c) is required in (semi-)automatic mode."
return False 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 return True
......
...@@ -59,7 +59,7 @@ TEST_CONFIG = { ...@@ -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): status_password=None):
"""Convenience wrapper.""" """Convenience wrapper."""
class Options(object): class Options(object):
...@@ -71,6 +71,7 @@ def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None, ...@@ -71,6 +71,7 @@ def MakeOptions(s=0, l=None, f=False, m=True, r=None, c=None,
options.m = m options.m = m
options.r = r options.r = r
options.c = c options.c = c
options.a = a
options.status_password = status_password options.status_password = status_password
return options return options
...@@ -673,7 +674,8 @@ Performance and stability improvements on all platforms.""", commit) ...@@ -673,7 +674,8 @@ Performance and stability improvements on all platforms.""", commit)
"Now working on version 3.22.6.%s\"" % review_suffix), "Now working on version 3.22.6.%s\"" % review_suffix),
" 2 files changed\n", " 2 files changed\n",
CheckPreparePush], 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"], "done\n"],
["cl presubmit", "Presubmit successfull\n"], ["cl presubmit", "Presubmit successfull\n"],
["cl dcommit -f --bypass-hooks", "Closing issue\n"], ["cl dcommit -f --bypass-hooks", "Closing issue\n"],
...@@ -698,7 +700,8 @@ Performance and stability improvements on all platforms.""", commit) ...@@ -698,7 +700,8 @@ Performance and stability improvements on all platforms.""", commit)
"(based on bleeding_edge revision r123455).\n\n" "(based on bleeding_edge revision r123455).\n\n"
"TBR=reviewer@chromium.org\""), "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", ""], ["checkout -f some_branch", ""],
["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""], ["branch -D %s" % TEST_CONFIG[TEMP_BRANCH], ""],
["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""], ["branch -D %s" % TEST_CONFIG[BRANCHNAME], ""],
...@@ -728,7 +731,7 @@ Performance and stability improvements on all platforms.""", commit) ...@@ -728,7 +731,7 @@ Performance and stability improvements on all platforms.""", commit)
if force: if force:
self.ExpectReadline([]) 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, r="reviewer@chromium.org" if not manual else None,
c = TEST_CONFIG[CHROMIUM]) c = TEST_CONFIG[CHROMIUM])
RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self) RunPushToTrunk(TEST_CONFIG, PushToTrunkOptions(options), self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment