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 | 6 # This script retrieves the history of all V8 branches 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 title = self.GitLog(n=1, format="%s", git_hash=git_hash) | 210 title = self.GitLog(n=1, format="%s", git_hash=git_hash) |
211 master_hash = self.GetMasterHashFromPush(title) | 211 master_hash = self.GetMasterHashFromPush(title) |
212 master_position = "" | 212 master_position = "" |
213 if master_hash: | 213 if master_hash: |
214 master_position = self.GetCommitPositionNumber(master_hash) | 214 master_position = self.GetCommitPositionNumber(master_hash) |
215 # TODO(machenbach): Add the commit position number. | 215 # TODO(machenbach): Add the commit position number. |
216 return self.GetReleaseDict( | 216 return self.GetReleaseDict( |
217 git_hash, master_position, master_hash, branch, version, | 217 git_hash, master_position, master_hash, branch, version, |
218 patches, body), self["patch"] | 218 patches, body), self["patch"] |
219 | 219 |
220 def GetReleasesFromMaster(self): | |
221 # TODO(machenbach): Implement this in git as soon as we tag again on | |
222 # master. | |
223 # tag_text = self.SVN("log https://v8.googlecode.com/svn/tags -v | |
224 # --limit 20") | |
225 # releases = [] | |
226 # for (tag, revision) in re.findall(BLEEDING_EDGE_TAGS_RE, tag_text): | |
227 # git_hash = self.vc.SvnGit(revision) | |
228 | |
229 # Add bleeding edge release. It does not contain patches or a code | |
230 # review link, as tags are not uploaded. | |
231 # releases.append(self.GetReleaseDict( | |
232 # git_hash, revision, git_hash, self.vc.MasterBranch(), tag, "", "")) | |
233 return [] | |
234 | |
235 def GetReleasesFromBranch(self, branch): | 220 def GetReleasesFromBranch(self, branch): |
236 self.GitReset(self.vc.RemoteBranch(branch)) | 221 self.GitReset(self.vc.RemoteBranch(branch)) |
237 if branch == self.vc.MasterBranch(): | 222 if branch == self.vc.MasterBranch(): |
238 return self.GetReleasesFromMaster() | 223 return self.GetReleasesFromMaster() |
239 | 224 |
240 releases = [] | 225 releases = [] |
241 try: | 226 try: |
242 for git_hash in self.GitLog(format="%H").splitlines(): | 227 for git_hash in self.GitLog(format="%H").splitlines(): |
243 if VERSION_FILE not in self.GitChangedFiles(git_hash): | 228 if VERSION_FILE not in self.GitChangedFiles(git_hash): |
244 continue | 229 continue |
(...skipping 13 matching lines...) Expand all Loading... |
258 break | 243 break |
259 | 244 |
260 # Allow Ctrl-C interrupt. | 245 # Allow Ctrl-C interrupt. |
261 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 246 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
262 pass | 247 pass |
263 | 248 |
264 # Clean up checked-out version file. | 249 # Clean up checked-out version file. |
265 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") | 250 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") |
266 return releases | 251 return releases |
267 | 252 |
| 253 def GetReleaseFromRevision(self, revision): |
| 254 releases = [] |
| 255 try: |
| 256 if (VERSION_FILE not in self.GitChangedFiles(revision) or |
| 257 not self.GitCheckoutFileSafe(VERSION_FILE, revision)): |
| 258 print "Skipping revision %s" % revision |
| 259 return [] # pragma: no cover |
| 260 |
| 261 branches = map( |
| 262 str.strip, |
| 263 self.Git("branch -r --contains %s" % revision).strip().splitlines(), |
| 264 ) |
| 265 branch = "" |
| 266 for b in branches: |
| 267 if b == "origin/candidates": |
| 268 branch = "candidates" |
| 269 break |
| 270 if b.startswith("branch-heads/"): |
| 271 branch = b.split("branch-heads/")[1] |
| 272 break |
| 273 else: |
| 274 print "Could not determine branch for %s" % revision |
| 275 |
| 276 release, _ = self.GetRelease(revision, branch) |
| 277 releases.append(release) |
| 278 |
| 279 # Allow Ctrl-C interrupt. |
| 280 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
| 281 pass |
| 282 |
| 283 # Clean up checked-out version file. |
| 284 self.GitCheckoutFileSafe(VERSION_FILE, "HEAD") |
| 285 return releases |
| 286 |
| 287 |
268 def RunStep(self): | 288 def RunStep(self): |
269 self.GitCreateBranch(self._config["BRANCHNAME"]) | 289 self.GitCreateBranch(self._config["BRANCHNAME"]) |
270 branches = self.vc.GetBranches() | |
271 releases = [] | 290 releases = [] |
272 if self._options.branch == 'recent': | 291 if self._options.branch == 'recent': |
273 # Get only recent development on candidates, beta and stable. | 292 # List every release from the last 7 days. |
274 if self._options.max_releases == 0: # pragma: no cover | 293 revisions = self.GetRecentReleases(max_age=7 * 24 * 60 * 60) |
275 self._options.max_releases = 10 | 294 for revision in revisions: |
276 beta, stable = SortBranches(branches)[0:2] | 295 releases += self.GetReleaseFromRevision(revision) |
277 releases += self.GetReleasesFromBranch(stable) | |
278 releases += self.GetReleasesFromBranch(beta) | |
279 releases += self.GetReleasesFromBranch(self.vc.CandidateBranch()) | |
280 releases += self.GetReleasesFromBranch(self.vc.MasterBranch()) | |
281 elif self._options.branch == 'all': # pragma: no cover | 296 elif self._options.branch == 'all': # pragma: no cover |
282 # Retrieve the full release history. | 297 # Retrieve the full release history. |
283 for branch in branches: | 298 for branch in self.vc.GetBranches(): |
284 releases += self.GetReleasesFromBranch(branch) | 299 releases += self.GetReleasesFromBranch(branch) |
285 releases += self.GetReleasesFromBranch(self.vc.CandidateBranch()) | 300 releases += self.GetReleasesFromBranch(self.vc.CandidateBranch()) |
286 releases += self.GetReleasesFromBranch(self.vc.MasterBranch()) | 301 releases += self.GetReleasesFromBranch(self.vc.MasterBranch()) |
287 else: # pragma: no cover | 302 else: # pragma: no cover |
288 # Retrieve history for a specified branch. | 303 # Retrieve history for a specified branch. |
289 assert self._options.branch in (branches + | 304 assert self._options.branch in (self.vc.GetBranches() + |
290 [self.vc.CandidateBranch(), self.vc.MasterBranch()]) | 305 [self.vc.CandidateBranch(), self.vc.MasterBranch()]) |
291 releases += self.GetReleasesFromBranch(self._options.branch) | 306 releases += self.GetReleasesFromBranch(self._options.branch) |
292 | 307 |
293 self["releases"] = sorted(releases, | 308 self["releases"] = sorted(releases, |
294 key=lambda r: SortingKey(r["version"]), | 309 key=lambda r: SortingKey(r["version"]), |
295 reverse=True) | 310 reverse=True) |
296 | 311 |
297 | 312 |
298 class SwitchChromium(Step): | 313 class SwitchChromium(Step): |
299 MESSAGE = "Switch to Chromium checkout." | 314 MESSAGE = "Switch to Chromium checkout." |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 UpdateChromiumCheckout, | 513 UpdateChromiumCheckout, |
499 RetrieveChromiumV8Releases, | 514 RetrieveChromiumV8Releases, |
500 RietrieveChromiumBranches, | 515 RietrieveChromiumBranches, |
501 CleanUp, | 516 CleanUp, |
502 WriteOutput, | 517 WriteOutput, |
503 ] | 518 ] |
504 | 519 |
505 | 520 |
506 if __name__ == "__main__": # pragma: no cover | 521 if __name__ == "__main__": # pragma: no cover |
507 sys.exit(Releases().Run()) | 522 sys.exit(Releases().Run()) |
OLD | NEW |