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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 help=('Chromium Git revision to roll to. Defaults to the ' | 442 help=('Chromium Git revision to roll to. Defaults to the ' |
443 'Chromium HEAD revision if omitted.')) | 443 'Chromium HEAD revision if omitted.')) |
444 p.add_argument('-u', '--rietveld-email', | 444 p.add_argument('-u', '--rietveld-email', |
445 help=('E-mail address to use for creating the CL at Rietveld' | 445 help=('E-mail address to use for creating the CL at Rietveld' |
446 'If omitted a previously cached one will be used or an ' | 446 'If omitted a previously cached one will be used or an ' |
447 'error will be thrown during upload.')) | 447 'error will be thrown during upload.')) |
448 p.add_argument('--dry-run', action='store_true', default=False, | 448 p.add_argument('--dry-run', action='store_true', default=False, |
449 help=('Calculate changes and modify DEPS, but don\'t create ' | 449 help=('Calculate changes and modify DEPS, but don\'t create ' |
450 'any local branch, commit, upload CL or send any ' | 450 'any local branch, commit, upload CL or send any ' |
451 'tryjobs.')) | 451 'tryjobs.')) |
| 452 p.add_argument('-i', '--ignore-unclean-workdir', action='store_true', |
| 453 default=False, |
| 454 help=('Ignore if the current branch is not master or if there ' |
| 455 'are uncommitted changes (default: %(default)s).')) |
452 p.add_argument('--skip-cq', action='store_true', default=False, | 456 p.add_argument('--skip-cq', action='store_true', default=False, |
453 help='Skip sending the CL to the CQ (default: %(default)s)') | 457 help='Skip sending the CL to the CQ (default: %(default)s)') |
454 p.add_argument('-v', '--verbose', action='store_true', default=False, | 458 p.add_argument('-v', '--verbose', action='store_true', default=False, |
455 help='Be extra verbose in printing of log messages.') | 459 help='Be extra verbose in printing of log messages.') |
456 opts = p.parse_args() | 460 opts = p.parse_args() |
457 | 461 |
458 if opts.verbose: | 462 if opts.verbose: |
459 logging.basicConfig(level=logging.DEBUG) | 463 logging.basicConfig(level=logging.DEBUG) |
460 else: | 464 else: |
461 logging.basicConfig(level=logging.INFO) | 465 logging.basicConfig(level=logging.INFO) |
462 | 466 |
463 if not _IsTreeClean(): | 467 if not opts.ignore_unclean_workdir and not _IsTreeClean(): |
464 logging.error('Please clean your local checkout first.') | 468 logging.error('Please clean your local checkout first.') |
465 return 1 | 469 return 1 |
466 | 470 |
467 if opts.clean: | 471 if opts.clean: |
468 _RemovePreviousRollBranch(opts.dry_run) | 472 _RemovePreviousRollBranch(opts.dry_run) |
469 | 473 |
470 _EnsureUpdatedMasterBranch(opts.dry_run) | 474 if not opts.ignore_unclean_workdir: |
| 475 _EnsureUpdatedMasterBranch(opts.dry_run) |
471 | 476 |
472 new_cr_rev = opts.revision | 477 new_cr_rev = opts.revision |
473 if not new_cr_rev: | 478 if not new_cr_rev: |
474 stdout, _ = _RunCommand(['git', 'ls-remote', CHROMIUM_SRC_URL, 'HEAD']) | 479 stdout, _ = _RunCommand(['git', 'ls-remote', CHROMIUM_SRC_URL, 'HEAD']) |
475 head_rev = stdout.strip().split('\t')[0] | 480 head_rev = stdout.strip().split('\t')[0] |
476 logging.info('No revision specified. Using HEAD: %s', head_rev) | 481 logging.info('No revision specified. Using HEAD: %s', head_rev) |
477 new_cr_rev = head_rev | 482 new_cr_rev = head_rev |
478 | 483 |
479 deps_filename = os.path.join(CHECKOUT_SRC_DIR, 'DEPS') | 484 deps_filename = os.path.join(CHECKOUT_SRC_DIR, 'DEPS') |
480 webrtc_deps = ParseLocalDepsFile(deps_filename) | 485 webrtc_deps = ParseLocalDepsFile(deps_filename) |
(...skipping 15 matching lines...) Expand all Loading... |
496 _CreateRollBranch(opts.dry_run) | 501 _CreateRollBranch(opts.dry_run) |
497 UpdateDepsFile(deps_filename, current_cr_rev, new_cr_rev, changed_deps) | 502 UpdateDepsFile(deps_filename, current_cr_rev, new_cr_rev, changed_deps) |
498 _LocalCommit(commit_msg, opts.dry_run) | 503 _LocalCommit(commit_msg, opts.dry_run) |
499 _UploadCL(opts.dry_run, opts.rietveld_email) | 504 _UploadCL(opts.dry_run, opts.rietveld_email) |
500 _SendToCQ(opts.dry_run, opts.skip_cq) | 505 _SendToCQ(opts.dry_run, opts.skip_cq) |
501 return 0 | 506 return 0 |
502 | 507 |
503 | 508 |
504 if __name__ == '__main__': | 509 if __name__ == '__main__': |
505 sys.exit(main()) | 510 sys.exit(main()) |
OLD | NEW |