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

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

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 months 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 22 matching lines...) Expand all
250 class SquashCommits(Step): 260 class SquashCommits(Step):
251 MESSAGE = "Squash commits into one." 261 MESSAGE = "Squash commits into one."
252 262
253 def RunStep(self): 263 def RunStep(self):
254 # Instead of relying on "git rebase -i", we'll just create a diff, because 264 # Instead of relying on "git rebase -i", we'll just create a diff, because
255 # that's easier to automate. 265 # that's easier to automate.
256 self.RestoreIfUnset("prepare_commit_hash") 266 self.RestoreIfUnset("prepare_commit_hash")
257 args = "diff svn/trunk %s" % self._state["prepare_commit_hash"] 267 args = "diff svn/trunk %s" % self._state["prepare_commit_hash"]
258 TextToFile(self.Git(args), self.Config(PATCH_FILE)) 268 TextToFile(self.Git(args), self.Config(PATCH_FILE))
259 269
260 # Convert the ChangeLog entry to commit message format: 270 # Convert the ChangeLog entry to commit message format.
261 # - remove date
262 # - remove indentation
263 # - merge paragraphs into single long lines, keeping empty lines between
264 # them.
265 self.RestoreIfUnset("date") 271 self.RestoreIfUnset("date")
266 changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)) 272 text = FileToText(self.Config(CHANGELOG_ENTRY_FILE))
267 273
268 # TODO(machenbach): This could create a problem if the changelog contained 274 # Remove date and trailing white space.
269 # any quotation marks. 275 text = re.sub(r"^%s: " % self._state["date"], "", text.rstrip())
270 text = Command("echo \"%s\" \ 276
271 | sed -e \"s/^%s: //\" \ 277 # Remove indentation and merge paragraphs into single long lines, keeping
272 | sed -e 's/^ *//' \ 278 # empty lines between them.
273 | awk '{ \ 279 def SplitMapJoin(split_text, fun, join_text):
274 if (need_space == 1) {\ 280 return lambda text: join_text.join(map(fun, text.split(split_text)))
275 printf(\" \");\ 281 strip = lambda line: line.strip()
276 };\ 282 text = SplitMapJoin("\n\n", SplitMapJoin("\n", strip, " "), "\n\n")(text)
277 printf(\"%%s\", $0);\
278 if ($0 ~ /^$/) {\
279 printf(\"\\n\\n\");\
280 need_space = 0;\
281 } else {\
282 need_space = 1;\
283 }\
284 }'" % (changelog_entry, self._state["date"]))
285 283
286 if not text: 284 if not text:
287 self.Die("Commit message editing failed.") 285 self.Die("Commit message editing failed.")
288 TextToFile(text, self.Config(COMMITMSG_FILE)) 286 TextToFile(text, self.Config(COMMITMSG_FILE))
289 os.remove(self.Config(CHANGELOG_ENTRY_FILE)) 287 os.remove(self.Config(CHANGELOG_ENTRY_FILE))
290 288
291 289
292 class NewBranch(Step): 290 class NewBranch(Step):
293 MESSAGE = "Create a new branch from trunk." 291 MESSAGE = "Create a new branch from trunk."
294 292
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 deps = FileToText(self.Config(DEPS_FILE)) 444 deps = FileToText(self.Config(DEPS_FILE))
447 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")", 445 deps = re.sub("(?<=\"v8_revision\": \")([0-9]+)(?=\")",
448 self._state["trunk_revision"], 446 self._state["trunk_revision"],
449 deps) 447 deps)
450 TextToFile(deps, self.Config(DEPS_FILE)) 448 TextToFile(deps, self.Config(DEPS_FILE))
451 449
452 self.RestoreVersionIfUnset() 450 self.RestoreVersionIfUnset()
453 ver = "%s.%s.%s" % (self._state["major"], 451 ver = "%s.%s.%s" % (self._state["major"],
454 self._state["minor"], 452 self._state["minor"],
455 self._state["build"]) 453 self._state["build"])
456 if self._options and self._options.r: 454 if self._options.r:
457 print "Using account %s for review." % self._options.r 455 print "Using account %s for review." % self._options.r
458 rev = self._options.r 456 rev = self._options.r
459 else: 457 else:
460 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: ",
461 self.DieNoManualMode("A reviewer must be specified in forced mode.") 459 self.DieNoManualMode("A reviewer must be specified in forced mode.")
462 rev = self.ReadLine() 460 rev = self.ReadLine()
463 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)
464 if self.Git(args) is None: 462 if self.Git(args) is None:
465 self.Die("'git commit' failed.") 463 self.Die("'git commit' failed.")
466 force_flag = " -f" if not self.IsManual() else "" 464 force_flag = " -f" if self._options.force_upload else ""
467 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:
468 self.Die("'git cl upload' failed, please try again.") 466 self.Die("'git cl upload' failed, please try again.")
469 print "CL uploaded." 467 print "CL uploaded."
470 468
471 469
472 class SwitchV8(Step): 470 class SwitchV8(Step):
473 MESSAGE = "Returning to V8 checkout." 471 MESSAGE = "Returning to V8 checkout."
474 REQUIRES = "chrome_path" 472 REQUIRES = "chrome_path"
475 473
476 def RunStep(self): 474 def RunStep(self):
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 return False 572 return False
575 return True 573 return True
576 574
577 575
578 def Main(): 576 def Main():
579 parser = BuildOptions() 577 parser = BuildOptions()
580 (options, args) = parser.parse_args() 578 (options, args) = parser.parse_args()
581 if not ProcessOptions(options): 579 if not ProcessOptions(options):
582 parser.print_help() 580 parser.print_help()
583 return 1 581 return 1
584 RunPushToTrunk(CONFIG, options) 582 RunPushToTrunk(CONFIG, PushToTrunkOptions(options))
585 583
586 if __name__ == "__main__": 584 if __name__ == "__main__":
587 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