Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: tools/push-to-trunk/push_to_trunk.py

Issue 114203002: Add named options to push-to-trunk script. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 the V8 project authors. All rights reserved. 2 # Copyright 2013 the V8 project authors. All rights reserved.
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following 10 # copyright notice, this list of conditions and the following
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 DOT_GIT_LOCATION: ".git", 45 DOT_GIT_LOCATION: ".git",
46 VERSION_FILE: "src/version.cc", 46 VERSION_FILE: "src/version.cc",
47 CHANGELOG_FILE: "ChangeLog", 47 CHANGELOG_FILE: "ChangeLog",
48 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", 48 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry",
49 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", 49 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file",
50 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", 50 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg",
51 DEPS_FILE: "DEPS", 51 DEPS_FILE: "DEPS",
52 } 52 }
53 53
54 54
55 class PushToTrunkOptions(CommonOptions):
56 def __init__(self, options):
57 super(PushToTrunkOptions, self).__init__(options, options.m)
58 self.requires_editor = not options.f
59 self.wait_for_lgtm = not options.f
60 self.tbr_commit = not options.m
61 self.l = options.l
62 self.r = options.r
63 self.c = options.c
64
55 class Preparation(Step): 65 class Preparation(Step):
56 MESSAGE = "Preparation." 66 MESSAGE = "Preparation."
57 67
58 def RunStep(self): 68 def RunStep(self):
59 self.InitialEnvironmentChecks() 69 self.InitialEnvironmentChecks()
60 self.CommonPrepare() 70 self.CommonPrepare()
61 self.PrepareBranch() 71 self.PrepareBranch()
62 self.DeleteBranch(self.Config(TRUNKBRANCH)) 72 self.DeleteBranch(self.Config(TRUNKBRANCH))
63 73
64 74
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 def RunStep(self): 217 def RunStep(self):
208 self.RestoreVersionIfUnset("new_") 218 self.RestoreVersionIfUnset("new_")
209 prep_commit_msg = ("Prepare push to trunk. " 219 prep_commit_msg = ("Prepare push to trunk. "
210 "Now working on version %s.%s.%s." % (self._state["new_major"], 220 "Now working on version %s.%s.%s." % (self._state["new_major"],
211 self._state["new_minor"], 221 self._state["new_minor"],
212 self._state["new_build"])) 222 self._state["new_build"]))
213 self.Persist("prep_commit_msg", prep_commit_msg) 223 self.Persist("prep_commit_msg", prep_commit_msg)
214 224
215 # Include optional TBR only in the git command. The persisted commit 225 # Include optional TBR only in the git command. The persisted commit
216 # message is used for finding the commit again later. 226 # message is used for finding the commit again later.
217 review = "\n\nTBR=%s" % self._options.r if not self.IsManual() else "" 227 review = "\n\nTBR=%s" % self._options.r if self._options.tbr_commit else ""
218 if self.Git("commit -a -m \"%s%s\"" % (prep_commit_msg, review)) is None: 228 if self.Git("commit -a -m \"%s%s\"" % (prep_commit_msg, review)) is None:
219 self.Die("'git commit -a' failed.") 229 self.Die("'git commit -a' failed.")
220 230
221 231
222 class CommitRepository(Step): 232 class CommitRepository(Step):
223 MESSAGE = "Commit to the repository." 233 MESSAGE = "Commit to the repository."
224 234
225 def RunStep(self): 235 def RunStep(self):
226 self.WaitForLGTM() 236 self.WaitForLGTM()
227 # Re-read the ChangeLog entry (to pick up possible changes). 237 # Re-read the ChangeLog entry (to pick up possible changes).
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 deps = FileToText(self.Config(DEPS_FILE)) 444 deps = FileToText(self.Config(DEPS_FILE))
435 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")", 445 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")",
436 self._state["trunk_revision"], 446 self._state["trunk_revision"],
437 deps) 447 deps)
438 TextToFile(deps, self.Config(DEPS_FILE)) 448 TextToFile(deps, self.Config(DEPS_FILE))
439 449
440 self.RestoreVersionIfUnset() 450 self.RestoreVersionIfUnset()
441 ver = "%s.%s.%s" % (self._state["major"], 451 ver = "%s.%s.%s" % (self._state["major"],
442 self._state["minor"], 452 self._state["minor"],
443 self._state["build"]) 453 self._state["build"])
444 if self._options and self._options.r: 454 if self._options.r:
445 print "Using account %s for review." % self._options.r 455 print "Using account %s for review." % self._options.r
446 rev = self._options.r 456 rev = self._options.r
447 else: 457 else:
448 print "Please enter the email address of a reviewer for the roll CL: ", 458 print "Please enter the email address of a reviewer for the roll CL: ",
449 self.DieNoManualMode("A reviewer must be specified in forced mode.") 459 self.DieNoManualMode("A reviewer must be specified in forced mode.")
450 rev = self.ReadLine() 460 rev = self.ReadLine()
451 args = "commit -am \"Update V8 to version %s.\n\nTBR=%s\"" % (ver, rev) 461 args = "commit -am \"Update V8 to version %s.\n\nTBR=%s\"" % (ver, rev)
452 if self.Git(args) is None: 462 if self.Git(args) is None:
453 self.Die("'git commit' failed.") 463 self.Die("'git commit' failed.")
454 force_flag = " -f" if not self.IsManual() else "" 464 force_flag = " -f" if self._options.force_upload else ""
455 if self.Git("cl upload --send-mail%s" % force_flag, pipe=False) is None: 465 if self.Git("cl upload --send-mail%s" % force_flag, pipe=False) is None:
456 self.Die("'git cl upload' failed, please try again.") 466 self.Die("'git cl upload' failed, please try again.")
457 print "CL uploaded." 467 print "CL uploaded."
458 468
459 469
460 class SwitchV8(Step): 470 class SwitchV8(Step):
461 MESSAGE = "Returning to V8 checkout." 471 MESSAGE = "Returning to V8 checkout."
462 REQUIRES = "chrome_path" 472 REQUIRES = "chrome_path"
463 473
464 def RunStep(self): 474 def RunStep(self):
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return False 572 return False
563 return True 573 return True
564 574
565 575
566 def Main(): 576 def Main():
567 parser = BuildOptions() 577 parser = BuildOptions()
568 (options, args) = parser.parse_args() 578 (options, args) = parser.parse_args()
569 if not ProcessOptions(options): 579 if not ProcessOptions(options):
570 parser.print_help() 580 parser.print_help()
571 return 1 581 return 1
572 RunPushToTrunk(CONFIG, options) 582 RunPushToTrunk(CONFIG, PushToTrunkOptions(options))
573 583
574 if __name__ == "__main__": 584 if __name__ == "__main__":
575 sys.exit(Main()) 585 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/push-to-trunk/common_includes.py ('k') | tools/push-to-trunk/test_scripts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698