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 | 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 def RunStep(self): | 352 def RunStep(self): |
| 353 cwd = self._options.chromium | 353 cwd = self._options.chromium |
| 354 | 354 |
| 355 # Update v8 checkout in chromium. | 355 # Update v8 checkout in chromium. |
| 356 self.GitFetchOrigin(cwd=os.path.join(cwd, "v8")) | 356 self.GitFetchOrigin(cwd=os.path.join(cwd, "v8")) |
| 357 | 357 |
| 358 # All v8 revisions we are interested in. | 358 # All v8 revisions we are interested in. |
| 359 releases_dict = dict((r["revision_git"], r) for r in self["releases"]) | 359 releases_dict = dict((r["revision_git"], r) for r in self["releases"]) |
| 360 | 360 |
| 361 cr_releases = [] | 361 cr_releases = [] |
| 362 count_past_last_v8 = 0 | |
| 362 try: | 363 try: |
| 363 for git_hash in self.GitLog( | 364 for git_hash in self.GitLog( |
| 364 format="%H", grep="V8", cwd=cwd).splitlines(): | 365 format="%H", grep="V8", cwd=cwd).splitlines(): |
| 365 if "DEPS" not in self.GitChangedFiles(git_hash, cwd=cwd): | 366 if "DEPS" not in self.GitChangedFiles(git_hash, cwd=cwd): |
| 366 continue | 367 continue |
| 367 if not self.GitCheckoutFileSafe("DEPS", git_hash, cwd=cwd): | 368 if not self.GitCheckoutFileSafe("DEPS", git_hash, cwd=cwd): |
| 368 break # pragma: no cover | 369 break # pragma: no cover |
| 369 deps = FileToText(os.path.join(cwd, "DEPS")) | 370 deps = FileToText(os.path.join(cwd, "DEPS")) |
| 370 match = DEPS_RE.search(deps) | 371 match = DEPS_RE.search(deps) |
| 371 if match: | 372 if match: |
| 372 cr_rev = self.GetCommitPositionNumber(git_hash, cwd=cwd) | 373 cr_rev = self.GetCommitPositionNumber(git_hash, cwd=cwd) |
| 373 if cr_rev: | 374 if cr_rev: |
| 374 v8_hsh = match.group(1) | 375 v8_hsh = match.group(1) |
| 375 cr_releases.append([cr_rev, v8_hsh]) | 376 cr_releases.append([cr_rev, v8_hsh]) |
| 376 | 377 |
| 378 if count_past_last_v8: | |
| 379 count_past_last_v8 += 1 # pragma: no cover | |
| 380 | |
| 381 if count_past_last_v8 > 10: | |
| 382 break # pragma: no cover | |
| 383 | |
| 377 # Stop as soon as we find a v8 revision that we didn't fetch in the | 384 # Stop as soon as we find a v8 revision that we didn't fetch in the |
| 378 # v8-revision-retrieval part above (i.e. a revision that's too old). | 385 # v8-revision-retrieval part above (i.e. a revision that's too old). |
| 386 # Just iterate a few more times in case there were reverts. | |
| 379 if v8_hsh not in releases_dict: | 387 if v8_hsh not in releases_dict: |
| 380 break # pragma: no cover | 388 count_past_last_v8 += 1 # pragma: no cover |
| 381 | 389 |
| 382 # Allow Ctrl-C interrupt. | 390 # Allow Ctrl-C interrupt. |
| 383 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 391 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
| 384 pass | 392 pass |
| 385 | 393 |
| 386 # Clean up. | 394 # Clean up. |
| 387 self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) | 395 self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) |
| 388 | 396 |
| 389 # Add the chromium ranges to the v8 candidates and master releases. | 397 # Add the chromium ranges to the v8 candidates and master releases. |
| 390 all_ranges = BuildRevisionRanges(cr_releases) | 398 all_ranges = BuildRevisionRanges(cr_releases) |
| 391 | 399 |
| 392 for hsh, ranges in all_ranges.iteritems(): | 400 for hsh, ranges in all_ranges.iteritems(): |
| 393 releases_dict.get(hsh, {})["chromium_revision"] = ranges | 401 releases_dict.get(hsh, {})["chromium_revision"] = ranges |
| 394 | 402 |
| 395 | 403 |
| 396 # TODO(machenbach): Unify common code with method above. | 404 # TODO(machenbach): Unify common code with method above. |
|
Michael Achenbach
2015/04/07 09:39:29
Sorry for the code dup... need to work on this TOD
| |
| 397 class RietrieveChromiumBranches(Step): | 405 class RietrieveChromiumBranches(Step): |
| 398 MESSAGE = "Retrieve Chromium branch information." | 406 MESSAGE = "Retrieve Chromium branch information." |
| 399 | 407 |
| 400 def RunStep(self): | 408 def RunStep(self): |
| 401 cwd = self._options.chromium | 409 cwd = self._options.chromium |
| 402 | 410 |
| 403 # All v8 revisions we are interested in. | 411 # All v8 revisions we are interested in. |
| 404 releases_dict = dict((r["revision_git"], r) for r in self["releases"]) | 412 releases_dict = dict((r["revision_git"], r) for r in self["releases"]) |
| 405 | 413 |
| 406 # Filter out irrelevant branches. | 414 # Filter out irrelevant branches. |
| 407 branches = filter(lambda r: re.match(r"branch-heads/\d+", r), | 415 branches = filter(lambda r: re.match(r"branch-heads/\d+", r), |
| 408 self.GitRemotes(cwd=cwd)) | 416 self.GitRemotes(cwd=cwd)) |
| 409 | 417 |
| 410 # Transform into pure branch numbers. | 418 # Transform into pure branch numbers. |
| 411 branches = map(lambda r: int(re.match(r"branch-heads/(\d+)", r).group(1)), | 419 branches = map(lambda r: int(re.match(r"branch-heads/(\d+)", r).group(1)), |
| 412 branches) | 420 branches) |
| 413 | 421 |
| 414 branches = sorted(branches, reverse=True) | 422 branches = sorted(branches, reverse=True) |
| 415 | 423 |
| 416 cr_branches = [] | 424 cr_branches = [] |
| 425 count_past_last_v8 = 0 | |
| 417 try: | 426 try: |
| 418 for branch in branches: | 427 for branch in branches: |
| 419 if not self.GitCheckoutFileSafe("DEPS", | 428 if not self.GitCheckoutFileSafe("DEPS", |
| 420 "branch-heads/%d" % branch, | 429 "branch-heads/%d" % branch, |
| 421 cwd=cwd): | 430 cwd=cwd): |
| 422 break # pragma: no cover | 431 break # pragma: no cover |
| 423 deps = FileToText(os.path.join(cwd, "DEPS")) | 432 deps = FileToText(os.path.join(cwd, "DEPS")) |
| 424 match = DEPS_RE.search(deps) | 433 match = DEPS_RE.search(deps) |
| 425 if match: | 434 if match: |
| 426 v8_hsh = match.group(1) | 435 v8_hsh = match.group(1) |
| 427 cr_branches.append([str(branch), v8_hsh]) | 436 cr_branches.append([str(branch), v8_hsh]) |
| 428 | 437 |
| 438 if count_past_last_v8: | |
| 439 count_past_last_v8 += 1 # pragma: no cover | |
| 440 | |
| 441 if count_past_last_v8 > 10: | |
| 442 break # pragma: no cover | |
| 443 | |
| 429 # Stop as soon as we find a v8 revision that we didn't fetch in the | 444 # Stop as soon as we find a v8 revision that we didn't fetch in the |
| 430 # v8-revision-retrieval part above (i.e. a revision that's too old). | 445 # v8-revision-retrieval part above (i.e. a revision that's too old). |
| 446 # Just iterate a few more times in case there were reverts. | |
| 431 if v8_hsh not in releases_dict: | 447 if v8_hsh not in releases_dict: |
| 432 break # pragma: no cover | 448 count_past_last_v8 += 1 # pragma: no cover |
| 433 | 449 |
| 434 # Allow Ctrl-C interrupt. | 450 # Allow Ctrl-C interrupt. |
| 435 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 451 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
| 436 pass | 452 pass |
| 437 | 453 |
| 438 # Clean up. | 454 # Clean up. |
| 439 self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) | 455 self.GitCheckoutFileSafe("DEPS", "HEAD", cwd=cwd) |
| 440 | 456 |
| 441 # Add the chromium branches to the v8 candidate releases. | 457 # Add the chromium branches to the v8 candidate releases. |
| 442 all_ranges = BuildRevisionRanges(cr_branches) | 458 all_ranges = BuildRevisionRanges(cr_branches) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 UpdateChromiumCheckout, | 522 UpdateChromiumCheckout, |
| 507 RetrieveChromiumV8Releases, | 523 RetrieveChromiumV8Releases, |
| 508 RietrieveChromiumBranches, | 524 RietrieveChromiumBranches, |
| 509 CleanUp, | 525 CleanUp, |
| 510 WriteOutput, | 526 WriteOutput, |
| 511 ] | 527 ] |
| 512 | 528 |
| 513 | 529 |
| 514 if __name__ == "__main__": # pragma: no cover | 530 if __name__ == "__main__": # pragma: no cover |
| 515 sys.exit(Releases().Run()) | 531 sys.exit(Releases().Run()) |
| OLD | NEW |