Commit ade95b74 authored by machenbach's avatar machenbach Committed by Commit bot

Push version and changelog as a separate commit.

BUG=chromium:451357
LOG=n
TBR=tandrii@chromium.org
NOTRY=true

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

Cr-Commit-Position: refs/heads/master@{#26251}
parent c421f3de
......@@ -287,6 +287,28 @@ class ApplyChanges(Step):
os.remove(self.Config("PATCH_FILE"))
class CommitSquash(Step):
MESSAGE = "Commit to local candidates branch."
def RunStep(self):
# Make a first commit with a slightly different title to not confuse
# the tagging.
msg = FileToText(self.Config("COMMITMSG_FILE")).splitlines()
msg[0] = msg[0].replace("(based on", "(squashed - based on")
self.GitCommit(message = "\n".join(msg))
class PrepareVersionBranch(Step):
MESSAGE = "Prepare new branch to commit version and changelog file."
def RunStep(self):
self.GitCheckout("master")
self.Git("fetch")
self.GitDeleteBranch(self.Config("TRUNKBRANCH"))
self.GitCreateBranch(self.Config("TRUNKBRANCH"),
self.vc.RemoteCandidateBranch())
class AddChangeLog(Step):
MESSAGE = "Add ChangeLog changes to trunk branch."
......@@ -312,8 +334,8 @@ class SetVersion(Step):
self.SetVersion(os.path.join(self.default_cwd, VERSION_FILE), "new_")
class CommitTrunk(Step):
MESSAGE = "Commit to local trunk branch."
class CommitCandidate(Step):
MESSAGE = "Commit version and changelog to local candidates branch."
def RunStep(self):
self.GitCommit(file_name = self.Config("COMMITMSG_FILE"))
......@@ -413,10 +435,13 @@ class PushToTrunk(ScriptsBase):
SquashCommits,
NewBranch,
ApplyChanges,
CommitSquash,
SanityCheck,
Land,
PrepareVersionBranch,
AddChangeLog,
SetVersion,
CommitTrunk,
SanityCheck,
CommitCandidate,
Land,
TagRevision,
CleanUp,
......
......@@ -719,6 +719,18 @@ Performance and stability improvements on all platforms."""
os.path.join(TEST_CONFIG["DEFAULT_CWD"], CHANGELOG_FILE))
os.environ["EDITOR"] = "vi"
commit_msg_squashed = """Version 3.22.5 (squashed - based on push_hash)
Log text 1 (issue 321).
Performance and stability improvements on all platforms."""
commit_msg = """Version 3.22.5 (based on push_hash)
Log text 1 (issue 321).
Performance and stability improvements on all platforms."""
def ResetChangeLog():
"""On 'git co -b new_branch svn/trunk', and 'git checkout -- ChangeLog',
the ChangLog will be reset to its content on trunk."""
......@@ -732,14 +744,9 @@ Performance and stability improvements on all platforms."""
ResetChangeLog()
self.WriteFakeVersionFile()
def CheckSVNCommit():
def CheckVersionCommit():
commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"])
self.assertEquals(
"""Version 3.22.5 (based on push_hash)
Log text 1 (issue 321).
Performance and stability improvements on all platforms.""", commit)
self.assertEquals(commit_msg, commit)
version = FileToText(
os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE))
self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version))
......@@ -808,16 +815,23 @@ Performance and stability improvements on all platforms.""", commit)
Cmd(("git new-branch %s --upstream origin/candidates" %
TEST_CONFIG["TRUNKBRANCH"]), "", cb=ResetToTrunk),
Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""),
Cmd("git commit -am \"%s\"" % commit_msg_squashed, ""),
]
if manual:
expectations.append(RL("Y")) # Sanity check.
expectations += [
Cmd("git cl land -f --bypass-hooks", ""),
Cmd("git checkout -f master", ""),
Cmd("git fetch", ""),
Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""),
Cmd(("git new-branch %s --upstream origin/candidates" %
TEST_CONFIG["TRUNKBRANCH"]), "", cb=ResetToTrunk),
Cmd("git checkout -f origin/candidates -- ChangeLog", "",
cb=ResetChangeLog),
Cmd("git checkout -f origin/candidates -- src/version.cc", "",
cb=self.WriteFakeVersionFile),
Cmd("git commit -aF \"%s\"" % TEST_CONFIG["COMMITMSG_FILE"], "",
cb=CheckSVNCommit),
]
if manual:
expectations.append(RL("Y")) # Sanity check.
expectations += [
cb=CheckVersionCommit),
Cmd("git cl land -f --bypass-hooks", ""),
Cmd("git fetch", ""),
Cmd("git log -1 --format=%H --grep="
......
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