TRUNKBRANCH = "TRUNKBRANCH"
CHROMIUM = "CHROMIUM"
DEPS_FILE = "DEPS_FILE"
-NEW_CHANGELOG_FILE = "NEW_CHANGELOG_FILE"
CONFIG = {
BRANCHNAME: "prepare-push",
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",
self.Die("Empty ChangeLog entry.")
# Safe new change log for adding it later to the trunk patch.
- TextToFile(changelog_entry, 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))
+ TextToFile(changelog_entry, self.Config(CHANGELOG_ENTRY_FILE))
class IncrementVersion(Step):
def RunStep(self):
self.WaitForLGTM()
- # Re-read the ChangeLog entry (to pick up possible changes).
- # FIXME(machenbach): This was hanging once with a broken pipe.
- TextToFile(GetLastChangeLogEntries(self.Config(CHANGELOG_FILE)),
- self.Config(CHANGELOG_ENTRY_FILE))
-
self.GitPresubmit()
self.GitDCommit()
if not text: # pragma: no cover
self.Die("Commit message editing failed.")
TextToFile(text, self.Config(COMMITMSG_FILE))
- os.remove(self.Config(CHANGELOG_ENTRY_FILE))
class NewBranch(Step):
# on trunk and apply the exact changes determined by this PrepareChangeLog
# step above.
self.GitCheckoutFile(self.Config(CHANGELOG_FILE), "svn/trunk")
- changelog_entry = FileToText(self.Config(NEW_CHANGELOG_FILE))
+ changelog_entry = FileToText(self.Config(CHANGELOG_ENTRY_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))
+ os.remove(self.Config(CHANGELOG_ENTRY_FILE))
class SetVersion(Step):
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",
def testEditChangeLog(self):
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
- TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
- TextToFile(" Original CL", TEST_CONFIG[CHANGELOG_FILE])
TextToFile(" New \n\tLines \n", TEST_CONFIG[CHANGELOG_ENTRY_FILE])
os.environ["EDITOR"] = "vi"
self.RunStep(PushToTrunk, EditChangeLog)
- self.assertEquals("New\n Lines\n\n\n Original CL",
- FileToText(TEST_CONFIG[CHANGELOG_FILE]))
+ self.assertEquals("New\n Lines",
+ FileToText(TEST_CONFIG[CHANGELOG_ENTRY_FILE]))
def testIncrementVersion(self):
TEST_CONFIG[VERSION_FILE] = self.MakeTempVersionFile()
self.assertEquals("6", self._state["new_build"])
self.assertEquals("0", self._state["new_patch"])
- def testLastChangeLogEntries(self):
- TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
- l = """
- Fixed something.
- (issue 1234)\n"""
- for _ in xrange(10): l = l + l
-
- cl_chunk = """2013-11-12: Version 3.23.2\n%s
- Performance and stability improvements on all platforms.\n\n\n""" % l
-
- cl_chunk_full = cl_chunk + cl_chunk + cl_chunk
- TextToFile(cl_chunk_full, TEST_CONFIG[CHANGELOG_FILE])
-
- cl = GetLastChangeLogEntries(TEST_CONFIG[CHANGELOG_FILE])
- self.assertEquals(cl_chunk, cl)
-
def _TestSquashCommits(self, change_log, expected_msg):
TEST_CONFIG[CHANGELOG_ENTRY_FILE] = self.MakeEmptyTempFile()
with open(TEST_CONFIG[CHANGELOG_ENTRY_FILE], "w") as f:
TEST_CONFIG[CHANGELOG_FILE] = self.MakeEmptyTempFile()
if not os.path.exists(TEST_CONFIG[CHROMIUM]):
os.makedirs(TEST_CONFIG[CHROMIUM])
- bleeding_edge_change_log = """1999-02-03: Version 3.12.2
-
- Performance and stability improvements on all platforms.\n"""
+ bleeding_edge_change_log = "2014-03-17: Sentinel\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"
def CheckPreparePush():
- cl = FileToText(TEST_CONFIG[CHANGELOG_FILE])
- self.assertTrue(re.search(r"Version 3.22.5", cl))
- self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl))
- self.assertFalse(re.search(r" \(author1@chromium\.org\)", cl))
-
- # Make sure all comments got stripped.
- self.assertFalse(re.search(r"^#", cl, flags=re.M))
+ self.assertEquals(bleeding_edge_change_log,
+ FileToText(TEST_CONFIG[CHANGELOG_FILE]))
version = FileToText(TEST_CONFIG[VERSION_FILE])
self.assertTrue(re.search(r"#define BUILD_NUMBER\s+6", version))