From 1973c2651f790a075af08305b9032ebc0095ea0c Mon Sep 17 00:00:00 2001 From: "machenbach@chromium.org" Date: Thu, 16 Oct 2014 13:21:13 +0000 Subject: [PATCH] Add v8 git hashes to releases script. Also change the tests to use git mode. BUG=chromium:410721 LOG=n TEST=script_test.py TBR=tandrii@chromium.org Review URL: https://codereview.chromium.org/658033005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24664 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- tools/push-to-trunk/releases.py | 16 +++- tools/push-to-trunk/test_scripts.py | 155 ++++++++++++++++++++++++------------ 2 files changed, 116 insertions(+), 55 deletions(-) diff --git a/tools/push-to-trunk/releases.py b/tools/push-to-trunk/releases.py index 34a4e8c..0cd9e61 100755 --- a/tools/push-to-trunk/releases.py +++ b/tools/push-to-trunk/releases.py @@ -140,13 +140,18 @@ class RetrieveV8Releases(Step): return patches def GetReleaseDict( - self, git_hash, bleeding_edge_rev, branch, version, patches, cl_body): + self, git_hash, bleeding_edge_rev, bleeding_edge_git, branch, version, + patches, cl_body): revision = self.vc.GitSvn(git_hash) return { # The SVN revision on the branch. "revision": revision, + # The git revision on the branch. + "revision_git": git_hash, # The SVN revision on bleeding edge (only for newer trunk pushes). "bleeding_edge": bleeding_edge_rev, + # The same for git. + "bleeding_edge_git": bleeding_edge_git, # The branch name. "branch": branch, # The version for displaying in the form 3.26.3 or 3.26.3.12. @@ -179,8 +184,13 @@ class RetrieveV8Releases(Step): patches = self.GetMergedPatches(body) title = self.GitLog(n=1, format="%s", git_hash=git_hash) + bleeding_edge_revision = self.GetBleedingEdgeFromPush(title) + bleeding_edge_git = "" + if bleeding_edge_revision: + bleeding_edge_git = self.vc.SvnGit(bleeding_edge_revision, + self.vc.RemoteMasterBranch()) return self.GetReleaseDict( - git_hash, self.GetBleedingEdgeFromPush(title), branch, version, + git_hash, bleeding_edge_revision, bleeding_edge_git, branch, version, patches, body), self["patch"] def GetReleasesFromMaster(self): @@ -192,7 +202,7 @@ class RetrieveV8Releases(Step): # Add bleeding edge release. It does not contain patches or a code # review link, as tags are not uploaded. releases.append(self.GetReleaseDict( - git_hash, revision, self.vc.MasterBranch(), tag, "", "")) + git_hash, revision, git_hash, self.vc.MasterBranch(), tag, "", "")) return releases def GetReleasesFromBranch(self, branch): diff --git a/tools/push-to-trunk/test_scripts.py b/tools/push-to-trunk/test_scripts.py index 3800b08..c551aa8 100644 --- a/tools/push-to-trunk/test_scripts.py +++ b/tools/push-to-trunk/test_scripts.py @@ -1513,46 +1513,46 @@ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b self.Expect([ Cmd("git status -s -uno", ""), Cmd("git status -s -b -uno", "## some_branch\n"), - Cmd("git svn fetch", ""), + Cmd("git fetch", ""), Cmd("git branch", " branch1\n* branch2\n"), Cmd("git checkout -b %s" % TEST_CONFIG["BRANCHNAME"], ""), - Cmd("git branch -r", " svn/3.21\n svn/3.3\n"), - Cmd("git reset --hard svn/3.3", ""), - Cmd("git log --format=%H", "hash1\nhash2"), + Cmd("git branch -r", " branch-heads/3.21\n branch-heads/3.3\n"), + Cmd("git reset --hard branch-heads/3.3", ""), + Cmd("git log --format=%H", "hash1\nhash_234"), Cmd("git diff --name-only hash1 hash1^", ""), - Cmd("git diff --name-only hash2 hash2^", VERSION_FILE), - Cmd("git checkout -f hash2 -- %s" % VERSION_FILE, "", + Cmd("git diff --name-only hash_234 hash_234^", VERSION_FILE), + Cmd("git checkout -f hash_234 -- %s" % VERSION_FILE, "", cb=ResetVersion(3, 1, 1)), - Cmd("git log -1 --format=%B hash2", + Cmd("git log -1 --format=%B hash_234", "Version 3.3.1.1 (merged 12)\n\nReview URL: fake.com\n"), - Cmd("git log -1 --format=%s hash2", ""), - Cmd("git svn find-rev hash2", "234"), - Cmd("git log -1 --format=%ci hash2", "18:15"), + Cmd("git log -1 --format=%s hash_234", ""), + Cmd("git svn find-rev hash_234", "234"), + Cmd("git log -1 --format=%ci hash_234", "18:15"), Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", cb=ResetVersion(22, 5)), - Cmd("git reset --hard svn/3.21", ""), - Cmd("git log --format=%H", "hash3\nhash4\nhash5\n"), - Cmd("git diff --name-only hash3 hash3^", VERSION_FILE), - Cmd("git checkout -f hash3 -- %s" % VERSION_FILE, "", + Cmd("git reset --hard branch-heads/3.21", ""), + Cmd("git log --format=%H", "hash_123\nhash4\nhash5\n"), + Cmd("git diff --name-only hash_123 hash_123^", VERSION_FILE), + Cmd("git checkout -f hash_123 -- %s" % VERSION_FILE, "", cb=ResetVersion(21, 2)), - Cmd("git log -1 --format=%B hash3", ""), - Cmd("git log -1 --format=%s hash3", ""), - Cmd("git svn find-rev hash3", "123"), - Cmd("git log -1 --format=%ci hash3", "03:15"), + Cmd("git log -1 --format=%B hash_123", ""), + Cmd("git log -1 --format=%s hash_123", ""), + Cmd("git svn find-rev hash_123", "123"), + Cmd("git log -1 --format=%ci hash_123", "03:15"), Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", cb=ResetVersion(22, 5)), - Cmd("git reset --hard svn/trunk", ""), - Cmd("git log --format=%H", "hash6\n"), - Cmd("git diff --name-only hash6 hash6^", VERSION_FILE), - Cmd("git checkout -f hash6 -- %s" % VERSION_FILE, "", + Cmd("git reset --hard origin/candidates", ""), + Cmd("git log --format=%H", "hash_345\n"), + Cmd("git diff --name-only hash_345 hash_345^", VERSION_FILE), + Cmd("git checkout -f hash_345 -- %s" % VERSION_FILE, "", cb=ResetVersion(22, 3)), - Cmd("git log -1 --format=%B hash6", ""), - Cmd("git log -1 --format=%s hash6", ""), - Cmd("git svn find-rev hash6", "345"), - Cmd("git log -1 --format=%ci hash6", ""), + Cmd("git log -1 --format=%B hash_345", ""), + Cmd("git log -1 --format=%s hash_345", ""), + Cmd("git svn find-rev hash_345", "345"), + Cmd("git log -1 --format=%ci hash_345", ""), Cmd("git checkout -f HEAD -- %s" % VERSION_FILE, "", cb=ResetVersion(22, 5)), - Cmd("git reset --hard svn/bleeding_edge", ""), + Cmd("git reset --hard origin/master", ""), Cmd("svn log https://v8.googlecode.com/svn/tags -v --limit 20", tag_response_text), Cmd("git svn find-rev r22626", "hash_22626"), @@ -1564,7 +1564,8 @@ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b Cmd("git status -s -uno", "", cwd=chrome_dir), Cmd("git checkout -f master", "", cwd=chrome_dir), Cmd("git pull", "", cwd=chrome_dir), - Cmd("git checkout -b %s" % TEST_CONFIG["BRANCHNAME"], "", cwd=chrome_dir), + Cmd("git checkout -b %s" % TEST_CONFIG["BRANCHNAME"], "", + cwd=chrome_dir), Cmd("git fetch origin", "", cwd=chrome_v8_dir), Cmd("git log --format=%H --grep=\"V8\"", "c_hash1\nc_hash2\nc_hash3\n", cwd=chrome_dir), @@ -1598,41 +1599,91 @@ git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3456 0039-1c4b ]) args = ["-c", TEST_CONFIG["CHROMIUM"], + "--vc-interface", "git_read_svn_write", "--json", json_output, "--csv", csv_output, "--max-releases", "1"] Releases(TEST_CONFIG, self).Run(args) # Check expected output. - csv = ("3.28.41,bleeding_edge,22626,,\r\n" - "3.28.40,bleeding_edge,22624,4567,\r\n" - "3.22.3,trunk,345,3456:4566,\r\n" + csv = ("3.28.41,master,22626,,\r\n" + "3.28.40,master,22624,4567,\r\n" + "3.22.3,candidates,345,3456:4566,\r\n" "3.21.2,3.21,123,,\r\n" "3.3.1.1,3.3,234,,12\r\n") self.assertEquals(csv, FileToText(csv_output)) expected_json = [ - {"bleeding_edge": "22626", "patches_merged": "", "version": "3.28.41", - "chromium_revision": "", "branch": "bleeding_edge", "revision": "22626", - "review_link": "", "date": "01:23", "chromium_branch": "", - "revision_link": "https://code.google.com/p/v8/source/detail?r=22626"}, - {"bleeding_edge": "22624", "patches_merged": "", "version": "3.28.40", - "chromium_revision": "4567", "branch": "bleeding_edge", - "revision": "22624", "review_link": "", "date": "02:34", - "chromium_branch": "", - "revision_link": "https://code.google.com/p/v8/source/detail?r=22624"}, - {"bleeding_edge": "", "patches_merged": "", "version": "3.22.3", - "chromium_revision": "3456:4566", "branch": "trunk", "revision": "345", - "review_link": "", "date": "", "chromium_branch": "7", - "revision_link": "https://code.google.com/p/v8/source/detail?r=345"}, - {"patches_merged": "", "bleeding_edge": "", "version": "3.21.2", - "chromium_revision": "", "branch": "3.21", "revision": "123", - "review_link": "", "date": "03:15", "chromium_branch": "", - "revision_link": "https://code.google.com/p/v8/source/detail?r=123"}, - {"patches_merged": "12", "bleeding_edge": "", "version": "3.3.1.1", - "chromium_revision": "", "branch": "3.3", "revision": "234", - "review_link": "fake.com", "date": "18:15", "chromium_branch": "", - "revision_link": "https://code.google.com/p/v8/source/detail?r=234"}, + { + "revision": "22626", + "revision_git": "hash_22626", + "bleeding_edge": "22626", + "bleeding_edge_git": "hash_22626", + "patches_merged": "", + "version": "3.28.41", + "chromium_revision": "", + "branch": "master", + "review_link": "", + "date": "01:23", + "chromium_branch": "", + "revision_link": "https://code.google.com/p/v8/source/detail?r=22626", + }, + { + "revision": "22624", + "revision_git": "hash_22624", + "bleeding_edge": "22624", + "bleeding_edge_git": "hash_22624", + "patches_merged": "", + "version": "3.28.40", + "chromium_revision": "4567", + "branch": "master", + "review_link": "", + "date": "02:34", + "chromium_branch": "", + "revision_link": "https://code.google.com/p/v8/source/detail?r=22624", + }, + { + "revision": "345", + "revision_git": "hash_345", + "bleeding_edge": "", + "bleeding_edge_git": "", + "patches_merged": "", + "version": "3.22.3", + "chromium_revision": "3456:4566", + "branch": "candidates", + "review_link": "", + "date": "", + "chromium_branch": "7", + "revision_link": "https://code.google.com/p/v8/source/detail?r=345", + }, + { + "revision": "123", + "revision_git": "hash_123", + "patches_merged": "", + "bleeding_edge": "", + "bleeding_edge_git": "", + "version": "3.21.2", + "chromium_revision": "", + "branch": "3.21", + "review_link": "", + "date": "03:15", + "chromium_branch": "", + "revision_link": "https://code.google.com/p/v8/source/detail?r=123", + }, + { + "revision": "234", + "revision_git": "hash_234", + "patches_merged": "12", + "bleeding_edge": "", + "bleeding_edge_git": "", + "version": "3.3.1.1", + "chromium_revision": "", + "branch": "3.3", + "review_link": "fake.com", + "date": "18:15", + "chromium_branch": "", + "revision_link": "https://code.google.com/p/v8/source/detail?r=234", + }, ] self.assertEquals(expected_json, json.loads(FileToText(json_output))) -- 2.7.4