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

Side by Side Diff: tools/autoroller/roll_chromium_revision.py

Issue 1369333010: autoroller: Add TBR= field and always update the checkout (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 """Script to roll chromium_revision in the WebRTC DEPS file.""" 10 """Script to roll chromium_revision in the WebRTC DEPS file."""
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 current_cr_rev = current_cr_rev[0:7] 252 current_cr_rev = current_cr_rev[0:7]
253 new_cr_rev = new_cr_rev[0:7] 253 new_cr_rev = new_cr_rev[0:7]
254 rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev) 254 rev_interval = '%s..%s' % (current_cr_rev, new_cr_rev)
255 255
256 current_git_number = ParseCommitPosition(ReadRemoteCrCommit(current_cr_rev)) 256 current_git_number = ParseCommitPosition(ReadRemoteCrCommit(current_cr_rev))
257 new_git_number = ParseCommitPosition(ReadRemoteCrCommit(new_cr_rev)) 257 new_git_number = ParseCommitPosition(ReadRemoteCrCommit(new_cr_rev))
258 git_number_interval = '%s:%s' % (current_git_number, new_git_number) 258 git_number_interval = '%s:%s' % (current_git_number, new_git_number)
259 259
260 commit_msg = ['Roll chromium_revision %s (%s)' % (rev_interval, 260 commit_msg = ['Roll chromium_revision %s (%s)' % (rev_interval,
261 git_number_interval)] 261 git_number_interval)]
262 262 # TBR field will be empty unless in some custom cases, where some engineers
263 # are added.
264 tbr_authors = ''
263 if changed_deps_list: 265 if changed_deps_list:
264 commit_msg.append('\nRelevant changes:') 266 commit_msg.append('\nRelevant changes:')
265 267
266 for c in changed_deps_list: 268 for c in changed_deps_list:
267 commit_msg.append('* %s: %s..%s' % (c.path, c.current_rev[0:7], 269 commit_msg.append('* %s: %s..%s' % (c.path, c.current_rev[0:7],
268 c.new_rev[0:7])) 270 c.new_rev[0:7]))
271 if 'libvpx' in c.path:
272 tbr_authors += 'marpan@webrtc.org, stefan@webrtc.org, '
269 273
270 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS') 274 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 'DEPS')
271 commit_msg.append('Details: %s' % change_url) 275 commit_msg.append('Details: %s' % change_url)
272 276
273 if clang_change.current_rev != clang_change.new_rev: 277 if clang_change.current_rev != clang_change.new_rev:
274 commit_msg.append('\nClang version changed %s:%s' % 278 commit_msg.append('\nClang version changed %s:%s' %
275 (clang_change.current_rev, clang_change.new_rev)) 279 (clang_change.current_rev, clang_change.new_rev))
276 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval, 280 change_url = CHROMIUM_FILE_TEMPLATE % (rev_interval,
277 CLANG_UPDATE_SCRIPT_URL_PATH) 281 CLANG_UPDATE_SCRIPT_URL_PATH)
278 commit_msg.append('Details: %s' % change_url) 282 commit_msg.append('Details: %s' % change_url)
283 tbr_authors += 'pbos@webrtc.org'
279 else: 284 else:
280 commit_msg.append('\nClang version was not updated in this roll.') 285 commit_msg.append('\nClang version was not updated in this roll.')
286 commit_msg.append('\nTBR=%s\n' % tbr_authors)
281 return '\n'.join(commit_msg) 287 return '\n'.join(commit_msg)
282 288
283 289
284 def UpdateDeps(deps_filename, old_cr_revision, new_cr_revision): 290 def UpdateDeps(deps_filename, old_cr_revision, new_cr_revision):
285 """Update the DEPS file with the new revision.""" 291 """Update the DEPS file with the new revision."""
286 with open(deps_filename, 'rb') as deps_file: 292 with open(deps_filename, 'rb') as deps_file:
287 deps_content = deps_file.read() 293 deps_content = deps_file.read()
288 deps_content = deps_content.replace(old_cr_revision, new_cr_revision) 294 deps_content = deps_content.replace(old_cr_revision, new_cr_revision)
289 with open(deps_filename, 'wb') as deps_file: 295 with open(deps_filename, 'wb') as deps_file:
290 deps_file.write(deps_content) 296 deps_file.write(deps_content)
291 297
292 def _IsTreeClean(): 298 def _IsTreeClean():
293 stdout, _ = _RunCommand(['git', 'status', '--porcelain']) 299 stdout, _ = _RunCommand(['git', 'status', '--porcelain'])
294 if len(stdout) == 0: 300 if len(stdout) == 0:
295 return True 301 return True
296 302
297 logging.error('Dirty/unversioned files:\n%s', stdout) 303 logging.error('Dirty/unversioned files:\n%s', stdout)
298 return False 304 return False
299 305
300 306
301 def _EnsureUpdatedMasterBranch(dry_run): 307 def _EnsureUpdatedMasterBranch(dry_run):
302 current_branch = _RunCommand( 308 current_branch = _RunCommand(
303 ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])[0].splitlines()[0] 309 ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])[0].splitlines()[0]
304 if current_branch != 'master': 310 if current_branch != 'master':
305 logging.error('Please checkout the master branch and re-run this script.') 311 logging.error('Please checkout the master branch and re-run this script.')
306 if not dry_run: 312 if not dry_run:
307 sys.exit(-1) 313 sys.exit(-1)
308 314
309 logging.info('Updating master branch...') 315 logging.info('Updating master branch...')
310 if not dry_run: 316 _RunCommand(['git', 'pull'])
311 _RunCommand(['git', 'pull'])
312 317
313 318
314 def _CreateRollBranch(dry_run): 319 def _CreateRollBranch(dry_run):
315 logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME) 320 logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME)
316 if not dry_run: 321 if not dry_run:
317 _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) 322 _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME])
318 323
319 324
320 def _RemovePreviousRollBranch(dry_run): 325 def _RemovePreviousRollBranch(dry_run):
321 active_branch, branches = _GetBranches() 326 active_branch, branches = _GetBranches()
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 _CreateRollBranch(opts.dry_run) 409 _CreateRollBranch(opts.dry_run)
405 UpdateDeps(deps_filename, current_cr_rev, opts.revision) 410 UpdateDeps(deps_filename, current_cr_rev, opts.revision)
406 _LocalCommit(commit_msg, opts.dry_run) 411 _LocalCommit(commit_msg, opts.dry_run)
407 _UploadCL(opts.dry_run) 412 _UploadCL(opts.dry_run)
408 _LaunchTrybots(opts.dry_run, opts.skip_try) 413 _LaunchTrybots(opts.dry_run, opts.skip_try)
409 return 0 414 return 0
410 415
411 416
412 if __name__ == '__main__': 417 if __name__ == '__main__':
413 sys.exit(main()) 418 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