Chromium Code Reviews| Index: tools/safely-roll-blink.py |
| diff --git a/tools/safely-roll-webkit.py b/tools/safely-roll-blink.py |
| similarity index 76% |
| rename from tools/safely-roll-webkit.py |
| rename to tools/safely-roll-blink.py |
| index 7ae1c5bd7a903520f650430af481820949ddd92d..fe3e9290bf0cc209f3fc7d9dfd938a2406dd99b5 100755 |
| --- a/tools/safely-roll-webkit.py |
| +++ b/tools/safely-roll-blink.py |
| @@ -24,7 +24,7 @@ def die_with_error(msg): |
| sys.exit(1) |
| -def process_deps(path, new_rev): |
| +def process_deps(path, new_rev, is_dry_run): |
| """Update webkit_revision to |new_issue|. |
| A bit hacky, could it be made better? |
| @@ -37,7 +37,8 @@ def process_deps(path, new_rev): |
| if not old_rev or new_content == content: |
| die_with_error('Failed to update the DEPS file') |
| - open(path, 'w').write(new_content) |
| + if not is_dry_run: |
| + open(path, 'w').write(new_content) |
| return old_rev |
| @@ -45,6 +46,7 @@ def main(): |
| tool_dir = os.path.dirname(os.path.abspath(__file__)) |
| parser = optparse.OptionParser(usage='%prog [options] <new webkit rev>') |
| parser.add_option('-v', '--verbose', action='count', default=0) |
| + parser.add_option('--dry-run', action='store_true', default=False) |
|
M-A Ruel
2013/04/24 01:40:23
Personally, I prefer to skip default=False and use
|
| parser.add_option('--commit', action='store_true', default=True, |
| help='(default) Put change in commit queue on upload.') |
| parser.add_option('--no-commit', action='store_false', dest='commit', |
| @@ -71,29 +73,39 @@ def main(): |
| os.chdir(root_dir) |
| new_rev = int(args[0]) |
| - print 'Roll webkit revision to %s' % new_rev |
| # Silence the editor. |
| os.environ['EDITOR'] = 'true' |
| old_branch = scm.GIT.GetBranch(root_dir) |
| - if old_branch == 'webkit_roll': |
| + if old_branch == 'blink_roll': |
| parser.error( |
| - 'Please delete the branch webkit_roll and move to a different branch') |
| - subprocess2.check_output( |
| - ['git', 'checkout', '-b', 'webkit_roll', options.upstream]) |
| + 'Please delete the branch blink_roll and move to a different branch') |
| + |
| + if not options.dry_run: |
| + subprocess2.check_output( |
| + ['git', 'checkout', '-b', 'blink_roll', options.upstream]) |
| + |
| try: |
| - old_rev = int(process_deps(os.path.join(root_dir, 'DEPS'), new_rev)) |
| + old_rev = int(process_deps(os.path.join(root_dir, 'DEPS'), new_rev, |
| + options.dry_run)) |
| + print 'Blink roll %s:%s' % (old_rev, new_rev) |
| + |
| review_field = 'TBR' if options.commit else 'R' |
| - commit_msg = ('Webkit roll %s:%s\n' |
| + commit_msg = ('Blink roll %s:%s\n' |
| '\n' |
| - 'http://trac.webkit.org/log/?' |
| - 'rev=%s&stop_rev=%s&verbose=on\n' |
| + 'http://build.chromium.org/f/chromium/perf/dashboard/ui/' |
| + 'changelog_blink.html?url=/trunk&range=%s:%s&mode=html' |
| '\n' |
| '%s=%s\n' % (old_rev, new_rev, |
| - new_rev, old_rev+1, |
| + old_rev+1, new_rev, |
| review_field, |
| options.reviewers)) |
| + |
| + if options.dry_run: |
| + print 'Commit message: ' + commit_msg |
| + return 0 |
| + |
| subprocess2.check_output(['git', 'commit', '-m', commit_msg, 'DEPS']) |
| subprocess2.check_call(['git', 'diff', options.upstream]) |
| upload_cmd = ['git', 'cl', 'upload'] |
| @@ -105,8 +117,9 @@ def main(): |
| upload_cmd.extend(['--cc', options.cc]) |
| subprocess2.check_call(upload_cmd) |
| finally: |
| - subprocess2.check_output(['git', 'checkout', old_branch]) |
| - subprocess2.check_output(['git', 'branch', '-D', 'webkit_roll']) |
| + if not options.dry_run: |
| + subprocess2.check_output(['git', 'checkout', old_branch]) |
| + subprocess2.check_output(['git', 'branch', '-D', 'blink_roll']) |
| return 0 |