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, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 | 60 |
61 GITHASH_TO_SVN_URL = { | 61 GITHASH_TO_SVN_URL = { |
62 'chromium': CHROMIUM_GITHASH_TO_SVN_URL, | 62 'chromium': CHROMIUM_GITHASH_TO_SVN_URL, |
63 'blink': BLINK_GITHASH_TO_SVN_URL, | 63 'blink': BLINK_GITHASH_TO_SVN_URL, |
64 } | 64 } |
65 | 65 |
66 # Search pattern to be matched in the JSON output from | 66 # Search pattern to be matched in the JSON output from |
67 # CHROMIUM_GITHASH_TO_SVN_URL to get the chromium revision (svn revision). | 67 # CHROMIUM_GITHASH_TO_SVN_URL to get the chromium revision (svn revision). |
68 CHROMIUM_SEARCH_PATTERN = ( | 68 CHROMIUM_SEARCH_PATTERN = ( |
69 r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ') | 69 r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ') |
70 CHROMIUM_SEARCH_PATTERN_NEW = ( | |
71 r'Cr-Commit-Position: refs/heads/master@{#(\d+)}') | |
70 | 72 |
71 # Search pattern to be matched in the json output from | 73 # Search pattern to be matched in the json output from |
72 # BLINK_GITHASH_TO_SVN_URL to get the blink revision (svn revision). | 74 # BLINK_GITHASH_TO_SVN_URL to get the blink revision (svn revision). |
73 BLINK_SEARCH_PATTERN = ( | 75 BLINK_SEARCH_PATTERN = ( |
74 r'.*git-svn-id: svn://svn.chromium.org/blink/trunk@(\d+) ') | 76 r'.*git-svn-id: svn://svn.chromium.org/blink/trunk@(\d+) ') |
75 | 77 |
76 SEARCH_PATTERN = { | 78 SEARCH_PATTERN = { |
77 'chromium': CHROMIUM_SEARCH_PATTERN, | 79 'chromium': CHROMIUM_SEARCH_PATTERN, |
78 'blink': BLINK_SEARCH_PATTERN, | 80 'blink': BLINK_SEARCH_PATTERN, |
79 } | 81 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 try: | 329 try: |
328 data = json.loads(response.read()[4:]) | 330 data = json.loads(response.read()[4:]) |
329 except ValueError: | 331 except ValueError: |
330 print 'ValueError for JSON URL: %s' % json_url | 332 print 'ValueError for JSON URL: %s' % json_url |
331 raise ValueError | 333 raise ValueError |
332 else: | 334 else: |
333 raise ValueError | 335 raise ValueError |
334 if 'message' in data: | 336 if 'message' in data: |
335 message = data['message'].split('\n') | 337 message = data['message'].split('\n') |
336 message = [line for line in message if line.strip()] | 338 message = [line for line in message if line.strip()] |
337 search_pattern = re.compile(SEARCH_PATTERN[depot]) | 339 search_pattern = re.compile(SEARCH_PATTERN[depot]) |
DaleCurtis
2014/09/05 21:51:30
Should you flip the order of these as we move into
pshenoy
2014/09/05 22:25:56
Done.
| |
338 result = search_pattern.search(message[len(message)-1]) | 340 result = search_pattern.search(message[len(message)-1]) |
339 if result: | 341 if result: |
340 return result.group(1) | 342 return result.group(1) |
343 else: | |
344 if depot == 'chromium': | |
345 result = re.search(CHROMIUM_SEARCH_PATTERN_NEW, | |
346 message[len(message)-1]) | |
347 if result: | |
348 return result.group(1) | |
341 print 'Failed to get svn revision number for %s' % git_sha1 | 349 print 'Failed to get svn revision number for %s' % git_sha1 |
342 raise ValueError | 350 raise ValueError |
343 | 351 |
344 def _GetSVNRevisionFromGitHashFromGitCheckout(self, git_sha1, depot): | 352 def _GetSVNRevisionFromGitHashFromGitCheckout(self, git_sha1, depot): |
345 def _RunGit(command, path): | 353 def _RunGit(command, path): |
346 command = ['git'] + command | 354 command = ['git'] + command |
347 if path: | 355 if path: |
348 original_path = os.getcwd() | 356 original_path = os.getcwd() |
349 os.chdir(path) | 357 os.chdir(path) |
350 shell = sys.platform.startswith('win') | 358 shell = sys.platform.startswith('win') |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1160 | 1168 |
1161 print 'CHANGELOG URL:' | 1169 print 'CHANGELOG URL:' |
1162 if opts.official_builds: | 1170 if opts.official_builds: |
1163 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) | 1171 print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev) |
1164 else: | 1172 else: |
1165 PrintChangeLog(min_chromium_rev, max_chromium_rev) | 1173 PrintChangeLog(min_chromium_rev, max_chromium_rev) |
1166 | 1174 |
1167 | 1175 |
1168 if __name__ == '__main__': | 1176 if __name__ == '__main__': |
1169 sys.exit(main()) | 1177 sys.exit(main()) |
OLD | NEW |