Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: tools/bisect-builds.py

Issue 547733003: bisect-builds.py: Add another search pattern to get SVN revision number from git hash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 BLINK_GITHASH_TO_SVN_URL = ( 58 BLINK_GITHASH_TO_SVN_URL = (
59 'https://chromium.googlesource.com/chromium/blink/+/%s?format=json') 59 'https://chromium.googlesource.com/chromium/blink/+/%s?format=json')
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_OLD = (
69 r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ')
68 CHROMIUM_SEARCH_PATTERN = ( 70 CHROMIUM_SEARCH_PATTERN = (
69 r'.*git-svn-id: svn://svn.chromium.org/chrome/trunk/src@(\d+) ') 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
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])
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_OLD,
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
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())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698