Don't use a temp file for changelog in push-to-trunk.

This is part of getting rid of the ChangeLog on bleeding_edge and directly modifying it on trunk.

BUG=
R=ulan@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19832 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d6f673eb
...@@ -36,6 +36,7 @@ from common_includes import * ...@@ -36,6 +36,7 @@ from common_includes import *
TRUNKBRANCH = "TRUNKBRANCH" TRUNKBRANCH = "TRUNKBRANCH"
CHROMIUM = "CHROMIUM" CHROMIUM = "CHROMIUM"
DEPS_FILE = "DEPS_FILE" DEPS_FILE = "DEPS_FILE"
NEW_CHANGELOG_FILE = "NEW_CHANGELOG_FILE"
CONFIG = { CONFIG = {
BRANCHNAME: "prepare-push", BRANCHNAME: "prepare-push",
...@@ -45,6 +46,7 @@ CONFIG = { ...@@ -45,6 +46,7 @@ CONFIG = {
DOT_GIT_LOCATION: ".git", DOT_GIT_LOCATION: ".git",
VERSION_FILE: "src/version.cc", VERSION_FILE: "src/version.cc",
CHANGELOG_FILE: "ChangeLog", CHANGELOG_FILE: "ChangeLog",
NEW_CHANGELOG_FILE: "/tmp/v8-push-to-trunk-tempfile-new-changelog",
CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry", CHANGELOG_ENTRY_FILE: "/tmp/v8-push-to-trunk-tempfile-changelog-entry",
PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file", PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file",
COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg", COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg",
...@@ -177,8 +179,6 @@ class EditChangeLog(Step): ...@@ -177,8 +179,6 @@ class EditChangeLog(Step):
"save the file and exit your EDITOR. ") "save the file and exit your EDITOR. ")
self.ReadLine(default="") self.ReadLine(default="")
self.Editor(self.Config(CHANGELOG_ENTRY_FILE)) self.Editor(self.Config(CHANGELOG_ENTRY_FILE))
handle, new_changelog = tempfile.mkstemp()
os.close(handle)
# Strip comments and reformat with correct indentation. # Strip comments and reformat with correct indentation.
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip() changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip()
...@@ -189,13 +189,12 @@ class EditChangeLog(Step): ...@@ -189,13 +189,12 @@ class EditChangeLog(Step):
if changelog_entry == "": if changelog_entry == "":
self.Die("Empty ChangeLog entry.") self.Die("Empty ChangeLog entry.")
with open(new_changelog, "w") as f: # Safe new change log for adding it later to the trunk patch.
f.write(changelog_entry) TextToFile(changelog_entry, self.Config(NEW_CHANGELOG_FILE))
f.write("\n\n\n") # Explicitly insert two empty lines.
AppendToFile(FileToText(self.Config(CHANGELOG_FILE)), new_changelog) old_change_log = FileToText(self.Config(CHANGELOG_FILE))
TextToFile(FileToText(new_changelog), self.Config(CHANGELOG_FILE)) new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log)
os.remove(new_changelog) TextToFile(new_change_log, self.Config(CHANGELOG_FILE))
class IncrementVersion(Step): class IncrementVersion(Step):
......
...@@ -52,6 +52,7 @@ TEST_CONFIG = { ...@@ -52,6 +52,7 @@ TEST_CONFIG = {
VERSION_FILE: None, VERSION_FILE: None,
CHANGELOG_FILE: None, CHANGELOG_FILE: None,
CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry", CHANGELOG_ENTRY_FILE: "/tmp/test-v8-push-to-trunk-tempfile-changelog-entry",
NEW_CHANGELOG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-new-changelog",
PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch", PATCH_FILE: "/tmp/test-v8-push-to-trunk-tempfile-patch",
COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg", COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg",
CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium", CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment