OLD | NEW |
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 deps_file.write(deps_content) | 290 deps_file.write(deps_content) |
291 | 291 |
292 def _IsTreeClean(): | 292 def _IsTreeClean(): |
293 stdout, _ = _RunCommand(['git', 'status', '--porcelain']) | 293 stdout, _ = _RunCommand(['git', 'status', '--porcelain']) |
294 if len(stdout) == 0: | 294 if len(stdout) == 0: |
295 return True | 295 return True |
296 | 296 |
297 logging.error('Dirty/unversioned files:\n%s', stdout) | 297 logging.error('Dirty/unversioned files:\n%s', stdout) |
298 return False | 298 return False |
299 | 299 |
300 def _CreateRollBranch(dry_run): | 300 |
| 301 def _EnsureUpdatedMasterBranch(dry_run): |
301 current_branch = _RunCommand( | 302 current_branch = _RunCommand( |
302 ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])[0].splitlines()[0] | 303 ['git', 'rev-parse', '--abbrev-ref', 'HEAD'])[0].splitlines()[0] |
303 if current_branch != 'master': | 304 if current_branch != 'master': |
304 logging.error('Please checkout the master branch and re-run this script.') | 305 logging.error('Please checkout the master branch and re-run this script.') |
305 if not dry_run: | 306 if not dry_run: |
306 sys.exit(-1) | 307 sys.exit(-1) |
307 | 308 |
308 logging.info('Updating master branch...') | 309 logging.info('Updating master branch...') |
309 if not dry_run: | 310 if not dry_run: |
310 _RunCommand(['git', 'pull']) | 311 _RunCommand(['git', 'pull']) |
| 312 |
| 313 |
| 314 def _CreateRollBranch(dry_run): |
311 logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME) | 315 logging.info('Creating roll branch: %s', ROLL_BRANCH_NAME) |
312 if not dry_run: | 316 if not dry_run: |
313 _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) | 317 _RunCommand(['git', 'checkout', '-b', ROLL_BRANCH_NAME]) |
314 | 318 |
315 | 319 |
316 def _RemovePreviousRollBranch(dry_run): | 320 def _RemovePreviousRollBranch(dry_run): |
317 active_branch, branches = _GetBranches() | 321 active_branch, branches = _GetBranches() |
318 if active_branch == ROLL_BRANCH_NAME: | 322 if active_branch == ROLL_BRANCH_NAME: |
319 active_branch = 'master' | 323 active_branch = 'master' |
320 if ROLL_BRANCH_NAME in branches: | 324 if ROLL_BRANCH_NAME in branches: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 else: | 369 else: |
366 logging.basicConfig(level=logging.INFO) | 370 logging.basicConfig(level=logging.INFO) |
367 | 371 |
368 if not _IsTreeClean(): | 372 if not _IsTreeClean(): |
369 logging.error('Please clean your local checkout first.') | 373 logging.error('Please clean your local checkout first.') |
370 return 1 | 374 return 1 |
371 | 375 |
372 if opts.clean: | 376 if opts.clean: |
373 _RemovePreviousRollBranch(opts.dry_run) | 377 _RemovePreviousRollBranch(opts.dry_run) |
374 | 378 |
| 379 _EnsureUpdatedMasterBranch(opts.dry_run) |
| 380 |
375 if not opts.revision: | 381 if not opts.revision: |
376 lkgr_contents = ReadUrlContent(CHROMIUM_LKGR_URL) | 382 lkgr_contents = ReadUrlContent(CHROMIUM_LKGR_URL) |
377 logging.info('No revision specified. Using LKGR: %s', lkgr_contents[0]) | 383 logging.info('No revision specified. Using LKGR: %s', lkgr_contents[0]) |
378 opts.revision = lkgr_contents[0] | 384 opts.revision = lkgr_contents[0] |
379 | 385 |
380 deps_filename = os.path.join(CHECKOUT_ROOT_DIR, 'DEPS') | 386 deps_filename = os.path.join(CHECKOUT_ROOT_DIR, 'DEPS') |
381 local_deps = ParseLocalDepsFile(deps_filename) | 387 local_deps = ParseLocalDepsFile(deps_filename) |
382 current_cr_rev = local_deps['vars']['chromium_revision'] | 388 current_cr_rev = local_deps['vars']['chromium_revision'] |
383 | 389 |
384 current_cr_deps = ParseRemoteCrDepsFile(current_cr_rev) | 390 current_cr_deps = ParseRemoteCrDepsFile(current_cr_rev) |
(...skipping 13 matching lines...) Expand all Loading... |
398 _CreateRollBranch(opts.dry_run) | 404 _CreateRollBranch(opts.dry_run) |
399 UpdateDeps(deps_filename, current_cr_rev, opts.revision) | 405 UpdateDeps(deps_filename, current_cr_rev, opts.revision) |
400 _LocalCommit(commit_msg, opts.dry_run) | 406 _LocalCommit(commit_msg, opts.dry_run) |
401 _UploadCL(opts.dry_run) | 407 _UploadCL(opts.dry_run) |
402 _LaunchTrybots(opts.dry_run, opts.skip_try) | 408 _LaunchTrybots(opts.dry_run, opts.skip_try) |
403 return 0 | 409 return 0 |
404 | 410 |
405 | 411 |
406 if __name__ == '__main__': | 412 if __name__ == '__main__': |
407 sys.exit(main()) | 413 sys.exit(main()) |
OLD | NEW |