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 29 matching lines...) Loading... | |
40 | 40 |
41 # Expression for retrieving reverted patches from a commit message (old and | 41 # Expression for retrieving reverted patches from a commit message (old and |
42 # new format). | 42 # new format). |
43 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M) | 43 ROLLBACK_MESSAGE_RE = re.compile(r"^.*[R|r]ollback of (.+)(\)| in).*$", re.M) |
44 | 44 |
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('^\\s*(?:(?:"|\')v8_revision(?:"|\'): (?:"|\')' |
Ryan Tseng
2014/08/25 13:19:17
running regex on the DEPS file? :/
you can use r"
Michael Achenbach
2014/08/25 13:32:52
The """ is good to know, thanks!
| |
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 '([^"\']+)(?:"|\').*$', re.M) |
54 | 54 |
55 # Expression to pick tag and revision for bleeding edge tags. To be used with | 55 # Expression to pick tag and revision for bleeding edge tags. To be used with |
56 # output of 'svn log'. | 56 # output of 'svn log'. |
57 BLEEDING_EDGE_TAGS_RE = re.compile( | 57 BLEEDING_EDGE_TAGS_RE = re.compile( |
58 r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)") | 58 r"A \/tags\/([^\s]+) \(from \/branches\/bleeding_edge\:(\d+)\)") |
59 | 59 |
60 # Regular expression that matches a single commit footer line. | 60 # Regular expression that matches a single commit footer line. |
61 COMMIT_FOOTER_ENTRY_RE = re.compile(r'([^:]+):\s+(.+)') | 61 COMMIT_FOOTER_ENTRY_RE = re.compile(r'([^:]+):\s+(.+)') |
62 | 62 |
63 # Footer metadata key for commit position. | 63 # Footer metadata key for commit position. |
(...skipping 303 matching lines...) Loading... | |
367 MESSAGE = "Update the checkout and create a new branch." | 367 MESSAGE = "Update the checkout and create a new branch." |
368 REQUIRES = "chrome_path" | 368 REQUIRES = "chrome_path" |
369 | 369 |
370 def RunStep(self): | 370 def RunStep(self): |
371 os.chdir(self["chrome_path"]) | 371 os.chdir(self["chrome_path"]) |
372 self.GitCheckout("master") | 372 self.GitCheckout("master") |
373 self.GitPull() | 373 self.GitPull() |
374 self.GitCreateBranch(self.Config(BRANCHNAME)) | 374 self.GitCreateBranch(self.Config(BRANCHNAME)) |
375 | 375 |
376 | 376 |
377 def ConvertToCommitNumber(step, revision): | |
378 if len(revision) > 6: | |
Ryan Tseng
2014/08/25 13:19:17
Reversing this make more sense
if revision.isdigi
Michael Achenbach
2014/08/25 13:32:52
Done.
| |
379 # Simple check for git hashes. | |
380 try: | |
381 # TODO(machenbach): Add cwd to git calls. | |
382 os.chdir(os.path.join(step["chrome_path"], "v8")) | |
Ryan Tseng
2014/08/25 13:19:17
I don't really like this, but seeing how the rest
Michael Achenbach
2014/08/25 13:32:52
Most of this/these files originated from some old
| |
383 return step.GitConvertToSVNRevision(revision) | |
384 finally: | |
385 os.chdir(step["chrome_path"]) | |
386 return revision | |
387 | |
388 | |
377 class RetrieveChromiumV8Releases(Step): | 389 class RetrieveChromiumV8Releases(Step): |
378 MESSAGE = "Retrieve V8 releases from Chromium DEPS." | 390 MESSAGE = "Retrieve V8 releases from Chromium DEPS." |
379 REQUIRES = "chrome_path" | 391 REQUIRES = "chrome_path" |
380 | 392 |
381 def RunStep(self): | 393 def RunStep(self): |
382 os.chdir(self["chrome_path"]) | 394 os.chdir(self["chrome_path"]) |
383 | 395 |
384 releases = filter( | 396 releases = filter( |
385 lambda r: r["branch"] in ["trunk", "bleeding_edge"], self["releases"]) | 397 lambda r: r["branch"] in ["trunk", "bleeding_edge"], self["releases"]) |
386 if not releases: # pragma: no cover | 398 if not releases: # pragma: no cover |
387 print "No releases detected. Skipping chromium history." | 399 print "No releases detected. Skipping chromium history." |
388 return True | 400 return True |
389 | 401 |
402 # Update v8 checkout in chromium. | |
403 try: | |
404 # TODO(machenbach): Add cwd to git calls. | |
405 os.chdir(os.path.join(self["chrome_path"], "v8")) | |
406 self.GitFetchOrigin() | |
Ryan Tseng
2014/08/25 13:19:17
You might have to either (1) rebase on current bra
Michael Achenbach
2014/08/25 13:32:52
Just reading the svn numbers.
| |
407 finally: | |
408 os.chdir(self["chrome_path"]) | |
409 | |
390 oldest_v8_rev = int(releases[-1]["revision"]) | 410 oldest_v8_rev = int(releases[-1]["revision"]) |
391 | 411 |
392 cr_releases = [] | 412 cr_releases = [] |
393 try: | 413 try: |
394 for git_hash in self.GitLog(format="%H", grep="V8").splitlines(): | 414 for git_hash in self.GitLog(format="%H", grep="V8").splitlines(): |
395 if self._config[DEPS_FILE] not in self.GitChangedFiles(git_hash): | 415 if self._config[DEPS_FILE] not in self.GitChangedFiles(git_hash): |
396 continue | 416 continue |
397 if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], git_hash): | 417 if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], git_hash): |
398 break # pragma: no cover | 418 break # pragma: no cover |
399 deps = FileToText(self.Config(DEPS_FILE)) | 419 deps = FileToText(self.Config(DEPS_FILE)) |
400 match = DEPS_RE.search(deps) | 420 match = DEPS_RE.search(deps) |
401 if match: | 421 if match: |
402 cr_rev = GetCommitPositionNumber(self, git_hash) | 422 cr_rev = GetCommitPositionNumber(self, git_hash) |
403 if cr_rev: | 423 if cr_rev: |
404 v8_rev = match.group(1) | 424 v8_rev = ConvertToCommitNumber(self, match.group(1)) |
405 cr_releases.append([cr_rev, v8_rev]) | 425 cr_releases.append([cr_rev, v8_rev]) |
406 | 426 |
407 # Stop after reaching beyond the last v8 revision we want to update. | 427 # Stop after reaching beyond the last v8 revision we want to update. |
408 # We need a small buffer for possible revert/reland frenzies. | 428 # We need a small buffer for possible revert/reland frenzies. |
409 # TODO(machenbach): Subtraction is not git friendly. | 429 # TODO(machenbach): Subtraction is not git friendly. |
410 if int(v8_rev) < oldest_v8_rev - 100: | 430 if int(v8_rev) < oldest_v8_rev - 100: |
411 break # pragma: no cover | 431 break # pragma: no cover |
412 | 432 |
413 # Allow Ctrl-C interrupt. | 433 # Allow Ctrl-C interrupt. |
414 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 434 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
(...skipping 36 matching lines...) Loading... | |
451 | 471 |
452 cr_branches = [] | 472 cr_branches = [] |
453 try: | 473 try: |
454 for branch in branches: | 474 for branch in branches: |
455 if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], | 475 if not self.GitCheckoutFileSafe(self._config[DEPS_FILE], |
456 "branch-heads/%d" % branch): | 476 "branch-heads/%d" % branch): |
457 break # pragma: no cover | 477 break # pragma: no cover |
458 deps = FileToText(self.Config(DEPS_FILE)) | 478 deps = FileToText(self.Config(DEPS_FILE)) |
459 match = DEPS_RE.search(deps) | 479 match = DEPS_RE.search(deps) |
460 if match: | 480 if match: |
461 v8_rev = match.group(1) | 481 v8_rev = ConvertToCommitNumber(self, match.group(1)) |
462 cr_branches.append([str(branch), v8_rev]) | 482 cr_branches.append([str(branch), v8_rev]) |
463 | 483 |
464 # Stop after reaching beyond the last v8 revision we want to update. | 484 # Stop after reaching beyond the last v8 revision we want to update. |
465 # We need a small buffer for possible revert/reland frenzies. | 485 # We need a small buffer for possible revert/reland frenzies. |
466 # TODO(machenbach): Subtraction is not git friendly. | 486 # TODO(machenbach): Subtraction is not git friendly. |
467 if int(v8_rev) < oldest_v8_rev - 100: | 487 if int(v8_rev) < oldest_v8_rev - 100: |
468 break # pragma: no cover | 488 break # pragma: no cover |
469 | 489 |
470 # Allow Ctrl-C interrupt. | 490 # Allow Ctrl-C interrupt. |
471 except (KeyboardInterrupt, SystemExit): # pragma: no cover | 491 except (KeyboardInterrupt, SystemExit): # pragma: no cover |
(...skipping 73 matching lines...) Loading... | |
545 RetrieveChromiumV8Releases, | 565 RetrieveChromiumV8Releases, |
546 RietrieveChromiumBranches, | 566 RietrieveChromiumBranches, |
547 SwitchV8, | 567 SwitchV8, |
548 CleanUp, | 568 CleanUp, |
549 WriteOutput, | 569 WriteOutput, |
550 ] | 570 ] |
551 | 571 |
552 | 572 |
553 if __name__ == "__main__": # pragma: no cover | 573 if __name__ == "__main__": # pragma: no cover |
554 sys.exit(Releases(CONFIG).Run()) | 574 sys.exit(Releases(CONFIG).Run()) |
OLD | NEW |