Reviewers: jarin,

Message:
PTAL

Description:
Make chromium-roll script non-interactive.

BUG=408523
LOG=n
[email protected]

Please review this at https://codereview.chromium.org/532743002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+18, -72 lines):
  M tools/push-to-trunk/auto_roll.py
  M tools/push-to-trunk/chromium_roll.py
  M tools/push-to-trunk/test_scripts.py


Index: tools/push-to-trunk/auto_roll.py
diff --git a/tools/push-to-trunk/auto_roll.py b/tools/push-to-trunk/auto_roll.py index 6e6c7fe2abcc091802a318d9d189cb09be87d20e..4267ac23ffaf997c4fe3b761a528c6737d8c221d 100755
--- a/tools/push-to-trunk/auto_roll.py
+++ b/tools/push-to-trunk/auto_roll.py
@@ -95,7 +95,6 @@ class RollChromium(Step):
         "--author", self._options.author,
         "--reviewer", self._options.reviewer,
         "--chromium", self._options.chromium,
-        "--force",
         "--use-commit-queue",
       ]
       if self._options.sheriff:
Index: tools/push-to-trunk/chromium_roll.py
diff --git a/tools/push-to-trunk/chromium_roll.py b/tools/push-to-trunk/chromium_roll.py index 44d7f3157f94dbf76774a3113381846ba230d847..4e0137057170b839483d64d2751b82af48d54635 100755
--- a/tools/push-to-trunk/chromium_roll.py
+++ b/tools/push-to-trunk/chromium_roll.py
@@ -37,25 +37,12 @@ class DetectLastPush(Step):
                                      git_hash=self["last_push"])


-class CheckChromium(Step):
-  MESSAGE = "Ask for chromium checkout."
-
-  def Run(self):
-    self["chrome_path"] = self._options.chromium
-    while not self["chrome_path"]:
- self.DieNoManualMode("Please specify the path to a Chromium checkout in "
-                           "forced mode.")
- print ("Please specify the path to the chromium \"src\" directory: "),
-      self["chrome_path"] = self.ReadLine()
-
-
 class SwitchChromium(Step):
   MESSAGE = "Switch to Chromium checkout."
-  REQUIRES = "chrome_path"

   def RunStep(self):
     self["v8_path"] = os.getcwd()
-    os.chdir(self["chrome_path"])
+    os.chdir(self._options.chromium)
     self.InitialEnvironmentChecks()
     # Check for a clean workdir.
     if not self.GitIsWorkdirClean():  # pragma: no cover
@@ -67,57 +54,47 @@ class SwitchChromium(Step):

 class UpdateChromiumCheckout(Step):
   MESSAGE = "Update the checkout and create a new branch."
-  REQUIRES = "chrome_path"

   def RunStep(self):
-    os.chdir(self["chrome_path"])
+    os.chdir(self._options.chromium)
     self.GitCheckout("master")
     self._side_effect_handler.Command("gclient", "sync --nohooks")
     self.GitPull()
     try:
       # TODO(machenbach): Add cwd to git calls.
-      os.chdir(os.path.join(self["chrome_path"], "v8"))
+      os.chdir(os.path.join(self._options.chromium, "v8"))
       self.GitFetchOrigin()
     finally:
-      os.chdir(self["chrome_path"])
+      os.chdir(self._options.chromium)
     self.GitCreateBranch("v8-roll-%s" % self["trunk_revision"])


 class UploadCL(Step):
   MESSAGE = "Create and upload CL."
-  REQUIRES = "chrome_path"

   def RunStep(self):
-    os.chdir(self["chrome_path"])
+    os.chdir(self._options.chromium)

     # Patch DEPS file.
     if self._side_effect_handler.Command(
         "roll-dep", "v8 %s" % self["trunk_revision"]) is None:
       self.Die("Failed to create deps for %s" % self["trunk_revision"])

-    if self._options.reviewer and not self._options.manual:
-      print "Using account %s for review." % self._options.reviewer
-      rev = self._options.reviewer
-    else:
- print "Please enter the email address of a reviewer for the roll CL: ",
-      self.DieNoManualMode("A reviewer must be specified in forced mode.")
-      rev = self.ReadLine()
-
     commit_title = "Update V8 to %s." % self["push_title"].lower()
     sheriff = ""
     if self["sheriff"]:
sheriff = ("\n\nPlease reply to the V8 sheriff %s in case of problems."
                  % self["sheriff"])
-    self.GitCommit("%s%s\n\nTBR=%s" % (commit_title, sheriff, rev))
+    self.GitCommit("%s%s\n\nTBR=%s" %
+                   (commit_title, sheriff, self._options.reviewer))
     self.GitUpload(author=self._options.author,
-                   force=self._options.force_upload,
+                   force=True,
                    cq=self._options.use_commit_queue)
     print "CL uploaded."


 class SwitchV8(Step):
   MESSAGE = "Returning to V8 checkout."
-  REQUIRES = "chrome_path"

   def RunStep(self):
     os.chdir(self["v8_path"])
@@ -137,14 +114,7 @@ class CleanUp(Step):

 class ChromiumRoll(ScriptsBase):
   def _PrepareOptions(self, parser):
-    group = parser.add_mutually_exclusive_group()
-    group.add_argument("-f", "--force",
-                      help="Don't prompt the user.",
-                      default=False, action="store_true")
-    group.add_argument("-m", "--manual",
-                      help="Prompt the user at every important step.",
-                      default=False, action="store_true")
-    parser.add_argument("-c", "--chromium",
+    parser.add_argument("-c", "--chromium", required=True,
                         help=("The path to your Chromium src/ "
                               "directory to automate the V8 roll."))
     parser.add_argument("-l", "--last-push",
@@ -154,24 +124,19 @@ class ChromiumRoll(ScriptsBase):
                         default=False, action="store_true")

   def _ProcessOptions(self, options):  # pragma: no cover
-    if not options.manual and not options.reviewer:
-      print "A reviewer (-r) is required in (semi-)automatic mode."
-      return False
-    if not options.manual and not options.chromium:
- print "A chromium checkout (-c) is required in (semi-)automatic mode."
-      return False
-    if not options.manual and not options.author:
- print "Specify your chromium.org email with -a in (semi-)automatic mode."
+    if not options.author or not options.reviewer:
+      print "A reviewer (-r) and an author (-a) are required."
       return False

-    options.tbr_commit = not options.manual
+    options.requires_editor = False
+    options.force = True
+    options.manual = False
     return True

   def _Steps(self):
     return [
       Preparation,
       DetectLastPush,
-      CheckChromium,
       DetermineV8Sheriff,
       SwitchChromium,
       UpdateChromiumCheckout,
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index 3df691adc61e6e80372cb14b5ae2ad5b76d66f8f..71b8a055102d8517f3580ed571526b0226da79cf 100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -800,7 +800,7 @@ Performance and stability improvements on all platforms.""", commit)
   def testPushToTrunkForced(self):
     self._PushToTrunk(force=True)

-  def _ChromiumRoll(self, force=False, manual=False):
+  def testChromiumRoll(self):
googlers_mapping_py = "%s-mapping.py" % TEST_CONFIG[PERSISTFILE_BASENAME]
     with open(googlers_mapping_py, "w") as f:
       f.write("""
@@ -820,8 +820,6 @@ def get_list():
       TextToFile("Some line\n   \"v8_revision\": \"123455\",\n  some line",
                  TEST_CONFIG[DEPS_FILE])

-    os.environ["EDITOR"] = "vi"
-    force_flag = " -f" if not manual else ""
     expectations = [
       Cmd("git status -s -uno", ""),
       Cmd("git status -s -b -uno", "## some_branch\n"),
@@ -841,39 +839,23 @@ def get_list():
       Cmd("git fetch origin", ""),
       Cmd("git checkout -b v8-roll-123455", ""),
       Cmd("roll-dep v8 123455", "rolled", cb=WriteDeps),
-    ]
-    if manual:
-      expectations.append(RL("[email protected]"))  # Chromium reviewer.
-    expectations += [
       Cmd(("git commit -am \"Update V8 to version 3.22.5 "
            "(based on bleeding_edge revision r123454).\n\n"
            "Please reply to the V8 sheriff [email protected] in "
            "case of problems.\n\[email protected]\""),
           ""),
-      Cmd(("git cl upload --send-mail --email \"[email protected]\"%s"
-           % force_flag), ""),
+ Cmd("git cl upload --send-mail --email \"[email protected]\" -f", ""),
     ]
     self.Expect(expectations)

     args = ["-a", "[email protected]", "-c", TEST_CONFIG[CHROMIUM],
-            "--sheriff", "--googlers-mapping", googlers_mapping_py]
-    if force: args.append("-f")
-    if manual: args.append("-m")
-    else: args += ["-r", "[email protected]"]
+            "--sheriff", "--googlers-mapping", googlers_mapping_py,
+            "-r", "[email protected]"]
     ChromiumRoll(TEST_CONFIG, self).Run(args)

     deps = FileToText(TEST_CONFIG[DEPS_FILE])
     self.assertTrue(re.search("\"v8_revision\": \"123455\"", deps))

-  def testChromiumRollManual(self):
-    self._ChromiumRoll(manual=True)
-
-  def testChromiumRollSemiAutomatic(self):
-    self._ChromiumRoll()
-
-  def testChromiumRollForced(self):
-    self._ChromiumRoll(force=True)
-
   def testCheckLastPushRecently(self):
     self.Expect([
       Cmd(("git log -1 --format=%H --grep="


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to