OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 import argparse | 29 import argparse |
30 import sys | 30 import sys |
31 import tempfile | 31 import tempfile |
32 import urllib2 | 32 import urllib2 |
33 | 33 |
34 from common_includes import * | 34 from common_includes import * |
35 | 35 |
36 TRUNKBRANCH = "TRUNKBRANCH" | 36 TRUNKBRANCH = "TRUNKBRANCH" |
37 CHROMIUM = "CHROMIUM" | 37 CHROMIUM = "CHROMIUM" |
38 DEPS_FILE = "DEPS_FILE" | 38 DEPS_FILE = "DEPS_FILE" |
| 39 NEW_CHANGELOG_FILE = "NEW_CHANGELOG_FILE" |
39 | 40 |
40 CONFIG = { | 41 CONFIG = { |
41 BRANCHNAME: "prepare-push", | 42 BRANCHNAME: "prepare-push", |
42 TRUNKBRANCH: "trunk-push", | 43 TRUNKBRANCH: "trunk-push", |
43 PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile", | 44 PERSISTFILE_BASENAME: "/tmp/v8-push-to-trunk-tempfile", |
44 TEMP_BRANCH: "prepare-push-temporary-branch-created-by-script", | 45 TEMP_BRANCH: "prepare-push-temporary-branch-created-by-script", |
45 DOT_GIT_LOCATION: ".git", | 46 DOT_GIT_LOCATION: ".git", |
46 VERSION_FILE: "src/version.cc", | 47 VERSION_FILE: "src/version.cc", |
47 CHANGELOG_FILE: "ChangeLog", | 48 CHANGELOG_FILE: "ChangeLog", |
| 49 NEW_CHANGELOG_FILE: "/tmp/v8-push-to-trunk-tempfile-new-changelog", |
48 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", | 50 CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", |
49 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", | 51 PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", |
50 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", | 52 COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", |
51 DEPS_FILE: "DEPS", | 53 DEPS_FILE: "DEPS", |
52 } | 54 } |
53 | 55 |
54 PUSH_MESSAGE_SUFFIX = " (based on bleeding_edge revision r%d)" | 56 PUSH_MESSAGE_SUFFIX = " (based on bleeding_edge revision r%d)" |
55 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") | 57 PUSH_MESSAGE_RE = re.compile(r".* \(based on bleeding_edge revision r(\d+)\)$") |
56 | 58 |
57 | 59 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 172 |
171 class EditChangeLog(Step): | 173 class EditChangeLog(Step): |
172 MESSAGE = "Edit ChangeLog entry." | 174 MESSAGE = "Edit ChangeLog entry." |
173 | 175 |
174 def RunStep(self): | 176 def RunStep(self): |
175 print ("Please press <Return> to have your EDITOR open the ChangeLog " | 177 print ("Please press <Return> to have your EDITOR open the ChangeLog " |
176 "entry, then edit its contents to your liking. When you're done, " | 178 "entry, then edit its contents to your liking. When you're done, " |
177 "save the file and exit your EDITOR. ") | 179 "save the file and exit your EDITOR. ") |
178 self.ReadLine(default="") | 180 self.ReadLine(default="") |
179 self.Editor(self.Config(CHANGELOG_ENTRY_FILE)) | 181 self.Editor(self.Config(CHANGELOG_ENTRY_FILE)) |
180 handle, new_changelog = tempfile.mkstemp() | |
181 os.close(handle) | |
182 | 182 |
183 # Strip comments and reformat with correct indentation. | 183 # Strip comments and reformat with correct indentation. |
184 changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip() | 184 changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip() |
185 changelog_entry = StripComments(changelog_entry) | 185 changelog_entry = StripComments(changelog_entry) |
186 changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines())) | 186 changelog_entry = "\n".join(map(Fill80, changelog_entry.splitlines())) |
187 changelog_entry = changelog_entry.lstrip() | 187 changelog_entry = changelog_entry.lstrip() |
188 | 188 |
189 if changelog_entry == "": | 189 if changelog_entry == "": |
190 self.Die("Empty ChangeLog entry.") | 190 self.Die("Empty ChangeLog entry.") |
191 | 191 |
192 with open(new_changelog, "w") as f: | 192 # Safe new change log for adding it later to the trunk patch. |
193 f.write(changelog_entry) | 193 TextToFile(changelog_entry, self.Config(NEW_CHANGELOG_FILE)) |
194 f.write("\n\n\n") # Explicitly insert two empty lines. | |
195 | 194 |
196 AppendToFile(FileToText(self.Config(CHANGELOG_FILE)), new_changelog) | 195 old_change_log = FileToText(self.Config(CHANGELOG_FILE)) |
197 TextToFile(FileToText(new_changelog), self.Config(CHANGELOG_FILE)) | 196 new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log) |
198 os.remove(new_changelog) | 197 TextToFile(new_change_log, self.Config(CHANGELOG_FILE)) |
199 | 198 |
200 | 199 |
201 class IncrementVersion(Step): | 200 class IncrementVersion(Step): |
202 MESSAGE = "Increment version number." | 201 MESSAGE = "Increment version number." |
203 | 202 |
204 def RunStep(self): | 203 def RunStep(self): |
205 new_build = str(int(self["build"]) + 1) | 204 new_build = str(int(self["build"]) + 1) |
206 | 205 |
207 if self.Confirm(("Automatically increment BUILD_NUMBER? (Saying 'n' will " | 206 if self.Confirm(("Automatically increment BUILD_NUMBER? (Saying 'n' will " |
208 "fire up your EDITOR on %s so you can make arbitrary " | 207 "fire up your EDITOR on %s so you can make arbitrary " |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 SwitchChromium, | 538 SwitchChromium, |
540 UpdateChromiumCheckout, | 539 UpdateChromiumCheckout, |
541 UploadCL, | 540 UploadCL, |
542 SwitchV8, | 541 SwitchV8, |
543 CleanUp, | 542 CleanUp, |
544 ] | 543 ] |
545 | 544 |
546 | 545 |
547 if __name__ == "__main__": | 546 if __name__ == "__main__": |
548 sys.exit(PushToTrunk(CONFIG).Run()) | 547 sys.exit(PushToTrunk(CONFIG).Run()) |
OLD | NEW |