Revision: 19832
Author:   [email protected]
Date:     Wed Mar 12 07:39:56 2014 UTC
Log:      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=
[email protected]

Review URL: https://codereview.chromium.org/195183003
http://code.google.com/p/v8/source/detail?r=19832

Modified:
 /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py
 /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py

=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Tue Mar 4 23:27:27 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/push_to_trunk.py Wed Mar 12 07:39:56 2014 UTC
@@ -36,6 +36,7 @@
 TRUNKBRANCH = "TRUNKBRANCH"
 CHROMIUM = "CHROMIUM"
 DEPS_FILE = "DEPS_FILE"
+NEW_CHANGELOG_FILE = "NEW_CHANGELOG_FILE"

 CONFIG = {
   BRANCHNAME: "prepare-push",
@@ -45,6 +46,7 @@
   DOT_GIT_LOCATION: ".git",
   VERSION_FILE: "src/version.cc",
   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",
   PATCH_FILE: "/tmp/v8-push-to-trunk-tempfile-patch-file",
   COMMITMSG_FILE: "/tmp/v8-push-to-trunk-tempfile-commitmsg",
@@ -177,8 +179,6 @@
            "save the file and exit your EDITOR. ")
     self.ReadLine(default="")
     self.Editor(self.Config(CHANGELOG_ENTRY_FILE))
-    handle, new_changelog = tempfile.mkstemp()
-    os.close(handle)

     # Strip comments and reformat with correct indentation.
changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_FILE)).rstrip()
@@ -189,13 +189,12 @@
     if changelog_entry == "":
       self.Die("Empty ChangeLog entry.")

-    with open(new_changelog, "w") as f:
-      f.write(changelog_entry)
-      f.write("\n\n\n")  # Explicitly insert two empty lines.
+    # Safe new change log for adding it later to the trunk patch.
+    TextToFile(changelog_entry, self.Config(NEW_CHANGELOG_FILE))

-    AppendToFile(FileToText(self.Config(CHANGELOG_FILE)), new_changelog)
-    TextToFile(FileToText(new_changelog), self.Config(CHANGELOG_FILE))
-    os.remove(new_changelog)
+    old_change_log = FileToText(self.Config(CHANGELOG_FILE))
+    new_change_log = "%s\n\n\n%s" % (changelog_entry, old_change_log)
+    TextToFile(new_change_log, self.Config(CHANGELOG_FILE))


 class IncrementVersion(Step):
=======================================
--- /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Tue Mar 4 23:27:27 2014 UTC +++ /branches/bleeding_edge/tools/push-to-trunk/test_scripts.py Wed Mar 12 07:39:56 2014 UTC
@@ -52,6 +52,7 @@
   VERSION_FILE: None,
   CHANGELOG_FILE: None,
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",
   COMMITMSG_FILE: "/tmp/test-v8-push-to-trunk-tempfile-commitmsg",
   CHROMIUM: "/tmp/test-v8-push-to-trunk-tempfile-chromium",

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to