Reviewers: jarin,

Message:
PTAL

Description:
Reland "Maintain change log file directly on trunk branch in push-to-trunk."

This uses the following approach to modify the trunk change log:
- Calculate the new change log entries
- Apply changes to the bleeding edge change log (this will be removed in a
follow up CL)
- Apply the diff between BE and trunk to trunk (this includes the diff of the
change log)
- Reset the change log to the version on trunk
- Reapply the new change log entries

Please review this at https://codereview.chromium.org/196473012/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+51, -2 lines):
  M tools/push-to-trunk/git_recipes.py
  M tools/push-to-trunk/push_to_trunk.py
  M tools/push-to-trunk/test_scripts.py


Index: tools/push-to-trunk/git_recipes.py
diff --git a/tools/push-to-trunk/git_recipes.py b/tools/push-to-trunk/git_recipes.py index fb7424f709478885ed5142d2dbb4c467f92b8222..6b54510f6365b0d3de1ffd3386570036cc382a3f 100644
--- a/tools/push-to-trunk/git_recipes.py
+++ b/tools/push-to-trunk/git_recipes.py
@@ -63,6 +63,10 @@ class GitRecipesMixin(object):
     assert name
     self.Git(MakeArgs(["checkout -f", name]))

+  def GitCheckoutFile(self, name):
+    assert name
+    self.Git(MakeArgs(["checkout --", name]))
+
   @Strip
   def GitCurrentBranch(self):
     for line in self.Git("status -s -b -uno").strip().splitlines():
Index: tools/push-to-trunk/push_to_trunk.py
diff --git a/tools/push-to-trunk/push_to_trunk.py b/tools/push-to-trunk/push_to_trunk.py index 0ebfb9c295c77df304390feccc8355aa77c697bf..ce1773447e423619b102740e24c9a3e210e1b7cf 100755
--- a/tools/push-to-trunk/push_to_trunk.py
+++ b/tools/push-to-trunk/push_to_trunk.py
@@ -311,6 +311,21 @@ class ApplyChanges(Step):
     Command("rm", "-f %s*" % self.Config(PATCH_FILE))


+class AddChangeLog(Step):
+  MESSAGE = "Add ChangeLog changes to trunk branch."
+
+  def RunStep(self):
+ # The change log has been modified by the patch. Reset it to the version + # on trunk and apply the exact changes determined by this PrepareChangeLog
+    # step above.
+    self.GitCheckoutFile(self.Config(CHANGELOG_FILE))
+    changelog_entry = FileToText(self.Config(NEW_CHANGELOG_FILE))
+    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))
+    os.remove(self.Config(NEW_CHANGELOG_FILE))
+
+
 class SetVersion(Step):
   MESSAGE = "Set correct version for trunk."

@@ -529,6 +544,7 @@ class PushToTrunk(ScriptsBase):
       SquashCommits,
       NewBranch,
       ApplyChanges,
+      AddChangeLog,
       SetVersion,
       CommitTrunk,
       SanityCheck,
Index: tools/push-to-trunk/test_scripts.py
diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index 112efdfe29a47caf40bf1b62b6072146bb751dd5..cff0a9ad9b3aca2bfd5b2e34904594d87e2894f2 100644
--- a/tools/push-to-trunk/test_scripts.py
+++ b/tools/push-to-trunk/test_scripts.py
@@ -642,7 +642,10 @@ Performance and stability improvements on all platforms."""
     TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
     if not os.path.exists(TEST_CONFIG[CHROMIUM]):
       os.makedirs(TEST_CONFIG[CHROMIUM])
-    TextToFile("1999-04-05: Version 3.22.4", TEST_CONFIG[CHANGELOG_FILE])
+    bleeding_edge_change_log = """1999-02-03: Version 3.12.2
+
+        Performance and stability improvements on all platforms.\n"""
+    TextToFile(bleeding_edge_change_log, TEST_CONFIG[CHANGELOG_FILE])
     TextToFile("Some line\n   \"v8_revision\": \"123444\",\n  some line",
                  TEST_CONFIG[DEPS_FILE])
     os.environ["EDITOR"] = "vi"
@@ -659,6 +662,14 @@ Performance and stability improvements on all platforms."""
       version = FileToText(TEST_CONFIG[VERSION_FILE])
       self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version))

+    def ResetChangeLog():
+ """On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog',
+      the ChangLog will be reset to its content on trunk."""
+      trunk_change_log = """1999-04-05: Version 3.22.4
+
+        Performance and stability improvements on all platforms.\n"""
+      TextToFile(trunk_change_log, TEST_CONFIG[CHANGELOG_FILE])
+
     def CheckSVNCommit():
       commit = FileToText(TEST_CONFIG[COMMITMSG_FILE])
       self.assertEquals(
@@ -674,6 +685,21 @@ Performance and stability improvements on all platforms.""", commit)
       self.assertTrue(re.search(r"#define PATCH_LEVEL\s+0", version))
self.assertTrue(re.search(r"#define IS_CANDIDATE_VERSION\s+0", version))

+ # Check that the change log on the trunk branch got correctly modified.
+      change_log = FileToText(TEST_CONFIG[CHANGELOG_FILE])
+      self.assertEquals(
+"""1999-07-31: Version 3.22.5
+
+        Log text 1 (issue 321).
+
+        Performance and stability improvements on all platforms.
+
+
+1999-04-05: Version 3.22.4
+
+        Performance and stability improvements on all platforms.\n""",
+          change_log)
+
     force_flag = " -f" if not manual else ""
     review_suffix = "\n\[email protected]" if not manual else ""
     self.ExpectGit([
@@ -712,8 +738,11 @@ Performance and stability improvements on all platforms.""", commit)
           "hash1\n"),
       Git("diff svn/trunk hash1", "patch content\n"),
       Git("svn find-rev hash1", "123455\n"),
-      Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], ""),
+      Git("checkout -b %s svn/trunk" % TEST_CONFIG[TRUNKBRANCH], "",
+          cb=ResetChangeLog),
       Git("apply --index --reject \"%s\"" % TEST_CONFIG[PATCH_FILE], ""),
+      Git("checkout -- %s" % TEST_CONFIG[CHANGELOG_FILE], "",
+          cb=ResetChangeLog),
       Git("add \"%s\"" % TEST_CONFIG[VERSION_FILE], ""),
       Git("commit -aF \"%s\"" % TEST_CONFIG[COMMITMSG_FILE], "",
           cb=CheckSVNCommit),


--
--
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