Chromium Code Reviews| 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 ec3e349f7e102a7728b1813ed089af3177a4238b..ee7a98d951e74f91ca0c66a7bf726e7b225f3b6e 100644 |
| --- a/tools/push-to-trunk/test_scripts.py |
| +++ b/tools/push-to-trunk/test_scripts.py |
| @@ -842,6 +842,125 @@ Performance and stability improvements on all platforms.""", commit) |
| def testPushToTrunkForced(self): |
| self._PushToTrunk(force=True) |
| + def testPushToTrunkForcedNewGit(self): |
|
Michael Achenbach
2014/10/08 13:07:40
This is a dirty c/p from the test above. The old v
|
| + TextToFile("", os.path.join(TEST_CONFIG["DEFAULT_CWD"], ".git")) |
| + |
| + # The version file on bleeding edge has build level 5, while the version |
| + # file from trunk has build level 4. |
| + self.WriteFakeVersionFile(build=5) |
| + |
| + TEST_CONFIG["CHANGELOG_ENTRY_FILE"] = self.MakeEmptyTempFile() |
| + TEST_CONFIG["CHANGELOG_FILE"] = self.MakeEmptyTempFile() |
| + bleeding_edge_change_log = "2014-03-17: Sentinel\n" |
| + TextToFile(bleeding_edge_change_log, TEST_CONFIG["CHANGELOG_FILE"]) |
| + |
| + 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 ResetToTrunk(): |
| + ResetChangeLog() |
| + self.WriteFakeVersionFile() |
| + |
| + def CheckSVNCommit(): |
| + commit = FileToText(TEST_CONFIG["COMMITMSG_FILE"]) |
| + self.assertEquals( |
| +"""Version 3.22.5 (based on bleeding_edge revision r123455) |
| + |
| +Log text 1 (issue 321). |
| + |
| +Performance and stability improvements on all platforms.""", commit) |
| + version = FileToText( |
| + os.path.join(TEST_CONFIG["DEFAULT_CWD"], VERSION_FILE)) |
| + self.assertTrue(re.search(r"#define MINOR_VERSION\s+22", version)) |
| + self.assertTrue(re.search(r"#define BUILD_NUMBER\s+5", version)) |
| + self.assertFalse(re.search(r"#define BUILD_NUMBER\s+6", version)) |
| + 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) |
| + |
| + expectations = [ |
| + Cmd("git status -s -uno", ""), |
| + Cmd("git status -s -b -uno", "## some_branch\n"), |
| + Cmd("git fetch", ""), |
| + Cmd("git branch", " branch1\n* branch2\n"), |
| + Cmd("git branch", " branch1\n* branch2\n"), |
| + Cmd("git checkout -b %s origin/master" % TEST_CONFIG["BRANCHNAME"], |
| + ""), |
| + Cmd("git svn find-rev r123455", "push_hash\n"), |
| + Cmd(("git log -1 --format=%H --grep=" |
| + "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\" " |
| + "origin/candidates"), "hash2\n"), |
| + Cmd("git log -1 hash2", "Log message\n"), |
| + Cmd("git log -1 --format=%s hash2", |
| + "Version 3.4.5 (based on bleeding_edge revision r1234)\n"), |
| + Cmd("git svn find-rev r1234", "hash3\n"), |
| + Cmd("git checkout -f origin/master -- src/version.cc", |
| + "", cb=self.WriteFakeVersionFile), |
| + Cmd("git checkout -f hash2 -- src/version.cc", "", |
| + cb=self.WriteFakeVersionFile), |
| + Cmd("git log --format=%H hash3..push_hash", "rev1\n"), |
| + Cmd("git log -1 --format=%s rev1", "Log text 1.\n"), |
| + Cmd("git log -1 --format=%B rev1", "Text\nLOG=YES\nBUG=v8:321\nText\n"), |
| + Cmd("git log -1 --format=%an rev1", "author1@chromium.org\n"), |
| + Cmd("git fetch", "fetch result\n"), |
| + Cmd("git checkout -f origin/master", ""), |
| + Cmd("git diff origin/candidates push_hash", "patch content\n"), |
| + Cmd("git svn find-rev push_hash", "123455\n"), |
| + Cmd("git checkout -b %s origin/candidates" % TEST_CONFIG["TRUNKBRANCH"], |
| + "", cb=ResetToTrunk), |
| + Cmd("git apply --index --reject \"%s\"" % TEST_CONFIG["PATCH_FILE"], ""), |
| + Cmd("git checkout -f origin/candidates -- %s" % |
| + TEST_CONFIG["CHANGELOG_FILE"], "", 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), |
| + Cmd("git svn dcommit 2>&1", ""), |
| + Cmd("git fetch", ""), |
| + Cmd("git log -1 --format=%H --grep=" |
| + "\"Version 3.22.5 (based on bleeding_edge revision r123455)\"" |
| + " origin/candidates", "hsh_to_tag"), |
| + Cmd("git tag 3.22.5 hsh_to_tag", ""), |
| + Cmd("git push origin 3.22.5", ""), |
| + Cmd("git checkout -f some_branch", ""), |
| + Cmd("git branch -D %s" % TEST_CONFIG["BRANCHNAME"], ""), |
| + Cmd("git branch -D %s" % TEST_CONFIG["TRUNKBRANCH"], ""), |
| + ] |
| + self.Expect(expectations) |
| + |
| + args = ["-a", "author@chromium.org", "--revision", "123455", |
| + "--vc-interface", "git_read_svn_write", "-f", |
|
Michael Achenbach
2014/10/08 13:07:40
The git tagging is still behind the flag --vc-inte
|
| + "-r", "reviewer@chromium.org"] |
| + PushToTrunk(TEST_CONFIG, self).Run(args) |
| + |
| + cl = FileToText(TEST_CONFIG["CHANGELOG_FILE"]) |
| + self.assertTrue(re.search(r"^\d\d\d\d\-\d+\-\d+: Version 3\.22\.5", cl)) |
| + self.assertTrue(re.search(r" Log text 1 \(issue 321\).", cl)) |
| + self.assertTrue(re.search(r"1999\-04\-05: Version 3\.22\.4", cl)) |
| + |
| + # Note: The version file is on build number 5 again in the end of this test |
| + # since the git command that merges to the bleeding edge branch is mocked |
| + # out. |
| + |
| C_V8_22624_LOG = """V8 CL. |
| git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22624 123 |