Add dry-run feature to auto roll scripts.
authormachenbach@chromium.org <machenbach@chromium.org>
Wed, 3 Sep 2014 08:29:53 +0000 (08:29 +0000)
committermachenbach@chromium.org <machenbach@chromium.org>
Wed, 3 Sep 2014 08:29:53 +0000 (08:29 +0000)
BUG=408523
LOG=n
TBR=jarin@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23633 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

tools/push-to-trunk/auto_roll.py
tools/push-to-trunk/chromium_roll.py
tools/push-to-trunk/common_includes.py

index 4267ac2..65fad92 100755 (executable)
@@ -100,6 +100,8 @@ class RollChromium(Step):
       if self._options.sheriff:
         args.extend([
             "--sheriff", "--googlers-mapping", self._options.googlers_mapping])
+      if self._options.dry_run:
+        args.extend(["--dry-run"])
       R = chromium_roll.ChromiumRoll
       self._side_effect_handler.Call(
           R(chromium_roll.CONFIG, self._side_effect_handler).Run,
@@ -111,8 +113,7 @@ class AutoRoll(ScriptsBase):
     parser.add_argument("-c", "--chromium", required=True,
                         help=("The path to your Chromium src/ "
                               "directory to automate the V8 roll."))
-    parser.add_argument("--roll",
-                        help="Make Chromium roll. Dry run if unspecified.",
+    parser.add_argument("--roll", help="Call Chromium roll script.",
                         default=False, action="store_true")
 
   def _ProcessOptions(self, options):  # pragma: no cover
index 4e01370..03f18f6 100755 (executable)
@@ -87,10 +87,15 @@ class UploadCL(Step):
                  % self["sheriff"])
     self.GitCommit("%s%s\n\nTBR=%s" %
                    (commit_title, sheriff, self._options.reviewer))
-    self.GitUpload(author=self._options.author,
-                   force=True,
-                   cq=self._options.use_commit_queue)
-    print "CL uploaded."
+    if not self._options.dry_run:
+      self.GitUpload(author=self._options.author,
+                     force=True,
+                     cq=self._options.use_commit_queue)
+      print "CL uploaded."
+    else:
+      self.GitCheckout("master")
+      self.GitDeleteBranch("v8-roll-%s" % self["trunk_revision"])
+      print "Dry run - don't upload."
 
 
 class SwitchV8(Step):
index 0e57a25..7770ce0 100644 (file)
@@ -592,6 +592,8 @@ class ScriptsBase(object):
     parser = argparse.ArgumentParser(description=self._Description())
     parser.add_argument("-a", "--author", default="",
                         help="The author email used for rietveld.")
+    parser.add_argument("--dry-run", default=False, action="store_true",
+                        help="Perform only read-only actions.")
     parser.add_argument("-g", "--googlers-mapping",
                         help="Path to the script mapping google accounts.")
     parser.add_argument("-r", "--reviewer", default="",