Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # This script retrieves the history of all V8 branches and trunk revisions and | 6 # This script retrieves the history of all V8 branches and trunk revisions and |
| 7 # their corresponding Chromium revisions. | 7 # their corresponding Chromium revisions. |
| 8 | 8 |
| 9 # Requires a chromium checkout with branch heads: | 9 # Requires a chromium checkout with branch heads: |
| 10 # gclient sync --with_branch_heads | 10 # gclient sync --with_branch_heads |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 # Expression for retrieving the code review link. | 45 # Expression for retrieving the code review link. |
| 46 REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M) | 46 REVIEW_LINK_RE = re.compile(r"^Review URL: (.+)$", re.M) |
| 47 | 47 |
| 48 # Expression with three versions (historical) for extracting the v8 revision | 48 # Expression with three versions (historical) for extracting the v8 revision |
| 49 # from the chromium DEPS file. | 49 # from the chromium DEPS file. |
| 50 DEPS_RE = re.compile(r'^\s*(?:"v8_revision": "' | 50 DEPS_RE = re.compile(r'^\s*(?:"v8_revision": "' |
| 51 '|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@' | 51 '|\(Var\("googlecode_url"\) % "v8"\) \+ "\/trunk@' |
| 52 '|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)' | 52 '|"http\:\/\/v8\.googlecode\.com\/svn\/trunk@)' |
| 53 '([0-9]+)".*$', re.M) | 53 '([0-9]+)".*$', re.M) |
| 54 | 54 |
| 55 # Expression to pick tag and revision for bleeding edge tags. To be used with | |
| 56 # output of 'svn log'. | |
| 57 BLEEDING_EDGE_TAGS_RE = re.compile( | |
| 58 r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)") | |
| 59 | |
| 55 | 60 |
| 56 def SortBranches(branches): | 61 def SortBranches(branches): |
| 57 """Sort branches with version number names.""" | 62 """Sort branches with version number names.""" |
| 58 return sorted(branches, key=SortingKey, reverse=True) | 63 return sorted(branches, key=SortingKey, reverse=True) |
| 59 | 64 |
| 60 | 65 |
| 61 def FilterDuplicatesAndReverse(cr_releases): | 66 def FilterDuplicatesAndReverse(cr_releases): |
| 62 """Returns the chromium releases in reverse order filtered by v8 revision | 67 """Returns the chromium releases in reverse order filtered by v8 revision |
| 63 duplicates. | 68 duplicates. |
| 64 | 69 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 | 138 |
| 134 def GetMergedPatches(self, body): | 139 def GetMergedPatches(self, body): |
| 135 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) | 140 patches = MatchSafe(MERGE_MESSAGE_RE.search(body)) |
| 136 if not patches: | 141 if not patches: |
| 137 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) | 142 patches = MatchSafe(ROLLBACK_MESSAGE_RE.search(body)) |
| 138 if patches: | 143 if patches: |
| 139 # Indicate reverted patches with a "-". | 144 # Indicate reverted patches with a "-". |
| 140 patches = "-%s" % patches | 145 patches = "-%s" % patches |
| 141 return patches | 146 return patches |
| 142 | 147 |
| 143 def GetRelease(self, git_hash, branch): | 148 def GetReleaseDict( |
| 144 self.ReadAndPersistVersion() | 149 self, git_hash, bleeding_edge_rev, branch, version, patches, cl_body): |
| 145 base_version = [self["major"], self["minor"], self["build"]] | |
| 146 version = ".".join(base_version) | |
| 147 body = self.GitLog(n=1, format="%B", git_hash=git_hash) | |
| 148 | |
| 149 patches = "" | |
| 150 if self["patch"] != "0": | |
| 151 version += ".%s" % self["patch"] | |
| 152 patches = self.GetMergedPatches(body) | |
| 153 | |
| 154 title = self.GitLog(n=1, format="%s", git_hash=git_hash) | |
| 155 revision = self.GitSVNFindSVNRev(git_hash) | 150 revision = self.GitSVNFindSVNRev(git_hash) |
| 156 return { | 151 return { |
|
Michael Achenbach
2014/07/28 12:56:35
Small refactoring. I move the dict creation to a s
| |
| 157 # The SVN revision on the branch. | 152 # The SVN revision on the branch. |
| 158 "revision": revision, | 153 "revision": revision, |
| 159 # The SVN revision on bleeding edge (only for newer trunk pushes). | 154 # The SVN revision on bleeding edge (only for newer trunk pushes). |
| 160 "bleeding_edge": self.GetBleedingEdgeFromPush(title), | 155 "bleeding_edge": bleeding_edge_rev, |
| 161 # The branch name. | 156 # The branch name. |
| 162 "branch": branch, | 157 "branch": branch, |
| 163 # The version for displaying in the form 3.26.3 or 3.26.3.12. | 158 # The version for displaying in the form 3.26.3 or 3.26.3.12. |
| 164 "version": version, | 159 "version": version, |
| 165 # The date of the commit. | 160 # The date of the commit. |
| 166 "date": self.GitLog(n=1, format="%ci", git_hash=git_hash), | 161 "date": self.GitLog(n=1, format="%ci", git_hash=git_hash), |
| 167 # Merged patches if available in the form 'r1234, r2345'. | 162 # Merged patches if available in the form 'r1234, r2345'. |
| 168 "patches_merged": patches, | 163 "patches_merged": patches, |
| 169 # Default for easier output formatting. | 164 # Default for easier output formatting. |
| 170 "chromium_revision": "", | 165 "chromium_revision": "", |
| 171 # Default for easier output formatting. | 166 # Default for easier output formatting. |
| 172 "chromium_branch": "", | 167 "chromium_branch": "", |
| 173 # Link to the CL on code review. Trunk pushes are not uploaded, so this | 168 # Link to the CL on code review. Trunk pushes are not uploaded, so this |
| 174 # field will be populated below with the recent roll CL link. | 169 # field will be populated below with the recent roll CL link. |
| 175 "review_link": MatchSafe(REVIEW_LINK_RE.search(body)), | 170 "review_link": MatchSafe(REVIEW_LINK_RE.search(cl_body)), |
| 176 # Link to the commit message on google code. | 171 # Link to the commit message on google code. |
| 177 "revision_link": ("https://code.google.com/p/v8/source/detail?r=%s" | 172 "revision_link": ("https://code.google.com/p/v8/source/detail?r=%s" |
| 178 % revision), | 173 % revision), |
| 179 }, self["patch"] | 174 } |
| 175 | |
| 176 def GetRelease(self, git_hash, branch): | |
| 177 self.ReadAndPersistVersion() | |
| 178 base_version = [self["major"], self["minor"], self["build"]] | |
| 179 version = ".".join(base_version) | |
| 180 body = self.GitLog(n=1, format="%B", git_hash=git_hash) | |
| 181 | |
| 182 patches = "" | |
| 183 if self["patch"] != "0": | |
| 184 version += ".%s" % self["patch"] | |
| 185 patches = self.GetMergedPatches(body) | |
| 186 | |
| 187 title = self.GitLog(n=1, format="%s", git_hash=git_hash) | |
| 188 return self.GetReleaseDict( | |
| 189 git_hash, self.GetBleedingEdgeFromPush(title), branch, version, | |
| 190 patches, body), self["patch"] | |
| 191 | |
| 192 def GetReleasesFromBleedingEdge(self): | |
| 193 tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v --limit 20") | |
| 194 releases = [] | |
| 195 for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text): | |
| 196 git_hash = self.GitSVNFindGitHash(revision) | |
| 197 | |
| 198 # Add bleeding edge release. It does not contain patches or a code | |
| 199 # review link, as tags are not uploaded. | |
| 200 releases.append(self.GetReleaseDict( | |
| 201 git_hash, revision, "bleeding_edge", tag, "", "")) | |
| 202 return releases | |
| 180 | 203 |
| 181 def GetReleasesFromBranch(self, branch): | 204 def GetReleasesFromBranch(self, branch): |
| 182 self.GitReset("svn/%s" % branch) | 205 self.GitReset("svn/%s" % branch) |
| 206 if branch == 'bleeding_edge': | |
| 207 return self.GetReleasesFromBleedingEdge() | |
| 208 | |
| 183 releases = [] | 209 releases = [] |
| 184 try: | 210 try: |
| 185 for git_hash in self.GitLog(format="%H").splitlines(): | 211 for git_hash in self.GitLog(format="%H").splitlines(): |
| 186 if self._config[VERSION_FILE] not in self.GitChangedFiles(git_hash): | 212 if self._config[VERSION_FILE] not in self.GitChangedFiles(git_hash): |
| 187 continue | 213 continue |
| 188 if self.ExceedsMax(releases): | 214 if self.ExceedsMax(releases): |
| 189 break # pragma: no cover | 215 break # pragma: no cover |
| 190 if not self.GitCheckoutFileSafe(self._config[VERSION_FILE], git_hash): | 216 if not self.GitCheckoutFileSafe(self._config[VERSION_FILE], git_hash): |
| 191 break # pragma: no cover | 217 break # pragma: no cover |
| 192 | 218 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 218 | 244 |
| 219 releases = [] | 245 releases = [] |
| 220 if self._options.branch == 'recent': | 246 if self._options.branch == 'recent': |
| 221 # Get only recent development on trunk, beta and stable. | 247 # Get only recent development on trunk, beta and stable. |
| 222 if self._options.max_releases == 0: # pragma: no cover | 248 if self._options.max_releases == 0: # pragma: no cover |
| 223 self._options.max_releases = 10 | 249 self._options.max_releases = 10 |
| 224 beta, stable = SortBranches(branches)[0:2] | 250 beta, stable = SortBranches(branches)[0:2] |
| 225 releases += self.GetReleasesFromBranch(stable) | 251 releases += self.GetReleasesFromBranch(stable) |
| 226 releases += self.GetReleasesFromBranch(beta) | 252 releases += self.GetReleasesFromBranch(beta) |
| 227 releases += self.GetReleasesFromBranch("trunk") | 253 releases += self.GetReleasesFromBranch("trunk") |
| 254 releases += self.GetReleasesFromBranch("bleeding_edge") | |
| 228 elif self._options.branch == 'all': # pragma: no cover | 255 elif self._options.branch == 'all': # pragma: no cover |
| 229 # Retrieve the full release history. | 256 # Retrieve the full release history. |
| 230 for branch in branches: | 257 for branch in branches: |
| 231 releases += self.GetReleasesFromBranch(branch) | 258 releases += self.GetReleasesFromBranch(branch) |
| 232 releases += self.GetReleasesFromBranch("trunk") | 259 releases += self.GetReleasesFromBranch("trunk") |
| 260 releases += self.GetReleasesFromBranch("bleeding_edge") | |
| 233 else: # pragma: no cover | 261 else: # pragma: no cover |
| 234 # Retrieve history for a specified branch. | 262 # Retrieve history for a specified branch. |
| 235 assert self._options.branch in branches + ["trunk"] | 263 assert self._options.branch in branches + ["trunk", "bleeding_edge"] |
| 236 releases += self.GetReleasesFromBranch(self._options.branch) | 264 releases += self.GetReleasesFromBranch(self._options.branch) |
| 237 | 265 |
| 238 self["releases"] = sorted(releases, | 266 self["releases"] = sorted(releases, |
| 239 key=lambda r: SortingKey(r["version"]), | 267 key=lambda r: SortingKey(r["version"]), |
| 240 reverse=True) | 268 reverse=True) |
| 241 | 269 |
| 242 | 270 |
| 243 # TODO(machenbach): Parts of the Chromium setup are c/p from the chromium_roll | 271 # TODO(machenbach): Parts of the Chromium setup are c/p from the chromium_roll |
| 244 # script -> unify. | 272 # script -> unify. |
| 245 class CheckChromium(Step): | 273 class CheckChromium(Step): |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 RetrieveChromiumV8Releases, | 472 RetrieveChromiumV8Releases, |
| 445 RietrieveChromiumBranches, | 473 RietrieveChromiumBranches, |
| 446 SwitchV8, | 474 SwitchV8, |
| 447 CleanUp, | 475 CleanUp, |
| 448 WriteOutput, | 476 WriteOutput, |
| 449 ] | 477 ] |
| 450 | 478 |
| 451 | 479 |
| 452 if __name__ == "__main__": # pragma: no cover | 480 if __name__ == "__main__": # pragma: no cover |
| 453 sys.exit(Releases(CONFIG).Run()) | 481 sys.exit(Releases(CONFIG).Run()) |
| OLD | NEW |