| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium 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 """Snapshot Build Bisect Tool | 6 """Snapshot Build Bisect Tool |
| 7 | 7 |
| 8 This script bisects a snapshot archive using binary search. It starts at | 8 This script bisects a snapshot archive using binary search. It starts at |
| 9 a bad revision (it will try to guess HEAD) and asks for a last known-good | 9 a bad revision (it will try to guess HEAD) and asks for a last known-good |
| 10 revision. It will then binary search across this revision range by downloading, | 10 revision. It will then binary search across this revision range by downloading, |
| 11 unzipping, and opening Chromium for you. After testing the specific revision, | 11 unzipping, and opening Chromium for you. After testing the specific revision, |
| 12 it will ask you whether it is good or bad before continuing the search. | 12 it will ask you whether it is good or bad before continuing the search. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 # The base URL for stored build archives. | 15 # The base URL for stored build archives. |
| 16 CHROMIUM_BASE_URL = ('http://commondatastorage.googleapis.com' | 16 CHROMIUM_BASE_URL = ('http://commondatastorage.googleapis.com' |
| 17 '/chromium-browser-snapshots') | 17 '/chromium-browser-snapshots') |
| 18 WEBKIT_BASE_URL = ('http://commondatastorage.googleapis.com' | 18 WEBKIT_BASE_URL = ('http://commondatastorage.googleapis.com' |
| 19 '/chromium-webkit-snapshots') | 19 '/chromium-webkit-snapshots') |
| 20 ASAN_BASE_URL = ('http://commondatastorage.googleapis.com' | 20 ASAN_BASE_URL = ('http://commondatastorage.googleapis.com' |
| 21 '/chromium-browser-asan') | 21 '/chromium-browser-asan') |
| 22 | 22 |
| 23 # URL template for viewing changelogs between revisions. | 23 # URL template for viewing changelogs between revisions. |
| 24 CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/src/+log/%s..%s') | 24 CHANGELOG_URL = ('https://chromium.googlesource.com/chromium/src/+log/%s..%s') |
| 25 | 25 |
| 26 # URL to convert SVN revision to git hash. | 26 # URL to convert SVN revision to git hash. |
| 27 CRREV_URL = ('https://cr-rev.appspot.com/_ah/api/crrev/v1/redirect/') | 27 CRREV_URL = ('https://cr-rev.appspot.com/_ah/api/crrev/v1/redirect/') |
| 28 | 28 |
| 29 # DEPS file URL. | 29 # DEPS file URL. |
| 30 DEPS_FILE_OLD = ('http://src.chromium.org/viewvc/chrome/trunk/src/' | 30 DEPS_FILE = ('https://chromium.googlesource.com/chromium/src/+/%s/DEPS') |
| 31 'DEPS?revision=%d') | |
| 32 DEPS_FILE_NEW = ('https://chromium.googlesource.com/chromium/src/+/%s/DEPS') | |
| 33 | 31 |
| 34 # Blink changelogs URL. | 32 # Blink changelogs URL. |
| 35 BLINK_CHANGELOG_URL = ('http://build.chromium.org' | 33 BLINK_CHANGELOG_URL = ('http://build.chromium.org' |
| 36 '/f/chromium/perf/dashboard/ui/changelog_blink.html' | 34 '/f/chromium/perf/dashboard/ui/changelog_blink.html' |
| 37 '?url=/trunk&range=%d%%3A%d') | 35 '?url=/trunk&range=%d%%3A%d') |
| 38 | 36 |
| 39 DONE_MESSAGE_GOOD_MIN = ('You are probably looking for a change made after %s (' | 37 DONE_MESSAGE_GOOD_MIN = ('You are probably looking for a change made after %s (' |
| 40 'known good), but no later than %s (first known bad).') | 38 'known good), but no later than %s (first known bad).') |
| 41 DONE_MESSAGE_GOOD_MAX = ('You are probably looking for a change made after %s (' | 39 DONE_MESSAGE_GOOD_MAX = ('You are probably looking for a change made after %s (' |
| 42 'known bad), but no later than %s (first known good).') | 40 'known bad), but no later than %s (first known good).') |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 887 |
| 890 | 888 |
| 891 def GetBlinkDEPSRevisionForChromiumRevision(self, rev): | 889 def GetBlinkDEPSRevisionForChromiumRevision(self, rev): |
| 892 """Returns the blink revision that was in REVISIONS file at | 890 """Returns the blink revision that was in REVISIONS file at |
| 893 chromium revision |rev|.""" | 891 chromium revision |rev|.""" |
| 894 | 892 |
| 895 def _GetBlinkRev(url, blink_re): | 893 def _GetBlinkRev(url, blink_re): |
| 896 m = blink_re.search(url.read()) | 894 m = blink_re.search(url.read()) |
| 897 url.close() | 895 url.close() |
| 898 if m: | 896 if m: |
| 899 return m.group(1) | 897 return m.group(1)] |
| 900 | 898 |
| 901 url = urllib.urlopen(DEPS_FILE_OLD % rev) | 899 url = urllib.urlopen(DEPS_FILE % GetGitHashFromSVNRevision(rev)) |
| 902 if url.getcode() == 200: | 900 if url.getcode() == 200: |
| 903 # . doesn't match newlines without re.DOTALL, so this is safe. | 901 blink_re = re.compile(r'webkit_revision\D*\d+;\D*\d+;(\w+)') |
| 904 blink_re = re.compile(r'webkit_revision\D*(\d+)') | 902 blink_git_sha = _GetBlinkRev(url, blink_re) |
| 905 return int(_GetBlinkRev(url, blink_re)) | 903 return self.GetSVNRevisionFromGitHash(blink_git_sha, 'blink') |
| 906 else: | |
| 907 url = urllib.urlopen(DEPS_FILE_NEW % GetGitHashFromSVNRevision(rev)) | |
| 908 if url.getcode() == 200: | |
| 909 blink_re = re.compile(r'webkit_revision\D*\d+;\D*\d+;(\w+)') | |
| 910 blink_git_sha = _GetBlinkRev(url, blink_re) | |
| 911 return self.GetSVNRevisionFromGitHash(blink_git_sha, 'blink') | |
| 912 raise Exception('Could not get Blink revision for Chromium rev %d' % rev) | 904 raise Exception('Could not get Blink revision for Chromium rev %d' % rev) |
| 913 | 905 |
| 914 | 906 |
| 915 def GetBlinkRevisionForChromiumRevision(context, rev): | 907 def GetBlinkRevisionForChromiumRevision(context, rev): |
| 916 """Returns the blink revision that was in REVISIONS file at | 908 """Returns the blink revision that was in REVISIONS file at |
| 917 chromium revision |rev|.""" | 909 chromium revision |rev|.""" |
| 918 def _IsRevisionNumber(revision): | 910 def _IsRevisionNumber(revision): |
| 919 if isinstance(revision, int): | 911 if isinstance(revision, int): |
| 920 return True | 912 return True |
| 921 else: | 913 else: |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1171 if min_blink_rev != max_blink_rev: | 1163 if min_blink_rev != max_blink_rev: |
| 1172 print ('NOTE: There is a Blink roll in the range, ' | 1164 print ('NOTE: There is a Blink roll in the range, ' |
| 1173 'you might also want to do a Blink bisect.') | 1165 'you might also want to do a Blink bisect.') |
| 1174 | 1166 |
| 1175 print 'CHANGELOG URL:' | 1167 print 'CHANGELOG URL:' |
| 1176 PrintChangeLog(min_chromium_rev, max_chromium_rev) | 1168 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
| 1177 | 1169 |
| 1178 | 1170 |
| 1179 if __name__ == '__main__': | 1171 if __name__ == '__main__': |
| 1180 sys.exit(main()) | 1172 sys.exit(main()) |
| OLD | NEW |