| OLD | NEW |
| 1 #!/usr/bin/python2 | 1 #!/usr/bin/python2 |
| 2 | 2 |
| 3 # Copyright 2014 Google Inc. | 3 # Copyright 2014 Google Inc. |
| 4 # | 4 # |
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
| 7 | 7 |
| 8 """Skia's Chromium DEPS roll script. | 8 """Skia's Chromium DEPS roll script. |
| 9 | 9 |
| 10 This script: | 10 This script: |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 git = config.git | 409 git = config.git |
| 410 with misc_utils.ChangeDir(config.chromium_path, config.verbose): | 410 with misc_utils.ChangeDir(config.chromium_path, config.verbose): |
| 411 config.vsp.check_call([git, 'fetch', '-q', 'origin']) | 411 config.vsp.check_call([git, 'fetch', '-q', 'origin']) |
| 412 | 412 |
| 413 old_revision = misc_utils.ReSearch.search_within_output( | 413 old_revision = misc_utils.ReSearch.search_within_output( |
| 414 config.verbose, '"skia_revision": "(?P<return>[0-9]+)",', None, | 414 config.verbose, '"skia_revision": "(?P<return>[0-9]+)",', None, |
| 415 [git, 'show', 'origin/master:DEPS']) | 415 [git, 'show', 'origin/master:DEPS']) |
| 416 assert old_revision | 416 assert old_revision |
| 417 if revision == int(old_revision): | 417 if revision == int(old_revision): |
| 418 print 'DEPS is up to date!' | 418 print 'DEPS is up to date!' |
| 419 return None | 419 return (None, None) |
| 420 | 420 |
| 421 master_hash = config.vsp.strip_output( | 421 master_hash = config.vsp.strip_output( |
| 422 [git, 'show-ref', 'origin/master', '--hash']) | 422 [git, 'show-ref', 'origin/master', '--hash']) |
| 423 master_revision = get_svn_revision(config, 'origin/master') | 423 master_revision = get_svn_revision(config, 'origin/master') |
| 424 | 424 |
| 425 # master_hash[8] gives each whitespace CL a unique name. | 425 # master_hash[8] gives each whitespace CL a unique name. |
| 426 if config.save_branches: | 426 if config.save_branches: |
| 427 branch = 'control_%s' % master_hash[:8] | 427 branch = 'control_%s' % master_hash[:8] |
| 428 else: | 428 else: |
| 429 branch = None | 429 branch = None |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if partial_hash: | 499 if partial_hash: |
| 500 revision, git_hash = revision_and_hash_from_partial( | 500 revision, git_hash = revision_and_hash_from_partial( |
| 501 config, partial_hash) | 501 config, partial_hash) |
| 502 elif revision: | 502 elif revision: |
| 503 revision, git_hash = revision_and_hash_from_revision(config, revision) | 503 revision, git_hash = revision_and_hash_from_revision(config, revision) |
| 504 else: | 504 else: |
| 505 revision, git_hash = revision_and_hash(config) | 505 revision, git_hash = revision_and_hash(config) |
| 506 | 506 |
| 507 print 'revision=%r\nhash=%r\n' % (revision, git_hash) | 507 print 'revision=%r\nhash=%r\n' % (revision, git_hash) |
| 508 | 508 |
| 509 roll = roll_deps(config, revision, git_hash) | 509 deps_issue, whitespace_issue = roll_deps(config, revision, git_hash) |
| 510 | 510 |
| 511 if roll: | 511 if deps_issue and whitespace_issue: |
| 512 deps_issue, whitespace_issue = roll | |
| 513 print 'DEPS roll:\n %s\n' % deps_issue | 512 print 'DEPS roll:\n %s\n' % deps_issue |
| 514 print 'Whitespace change:\n %s\n' % whitespace_issue | 513 print 'Whitespace change:\n %s\n' % whitespace_issue |
| 514 else: |
| 515 print >> sys.stderr, 'No issues created.' |
| 515 | 516 |
| 516 | 517 |
| 517 def main(args): | 518 def main(args): |
| 518 """main function; see module-level docstring and GetOptionParser help. | 519 """main function; see module-level docstring and GetOptionParser help. |
| 519 | 520 |
| 520 Args: | 521 Args: |
| 521 args: sys.argv[1:]-type argument list. | 522 args: sys.argv[1:]-type argument list. |
| 522 """ | 523 """ |
| 523 option_parser = DepsRollConfig.GetOptionParser() | 524 option_parser = DepsRollConfig.GetOptionParser() |
| 524 options = option_parser.parse_args(args)[0] | 525 options = option_parser.parse_args(args)[0] |
| 525 | 526 |
| 526 if not options.chromium_path: | 527 if not options.chromium_path: |
| 527 option_parser.error('Must specify chromium_path.') | 528 option_parser.error('Must specify chromium_path.') |
| 528 if not os.path.isdir(options.chromium_path): | 529 if not os.path.isdir(options.chromium_path): |
| 529 option_parser.error('chromium_path must be a directory.') | 530 option_parser.error('chromium_path must be a directory.') |
| 530 | 531 |
| 531 if not git_utils.git_executable(): | 532 if not git_utils.git_executable(): |
| 532 option_parser.error('Invalid git executable.') | 533 option_parser.error('Invalid git executable.') |
| 533 | 534 |
| 534 config = DepsRollConfig(options) | 535 config = DepsRollConfig(options) |
| 535 find_hash_and_roll_deps(config, options.revision, options.git_hash) | 536 find_hash_and_roll_deps(config, options.revision, options.git_hash) |
| 536 | 537 |
| 537 | 538 |
| 538 if __name__ == '__main__': | 539 if __name__ == '__main__': |
| 539 main(sys.argv[1:]) | 540 main(sys.argv[1:]) |
| 540 | 541 |
| OLD | NEW |