| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import collections | 7 import collections |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 def _UpdateReadmeFile(self, readme_path, new_revision): | 223 def _UpdateReadmeFile(self, readme_path, new_revision): |
| 224 readme = open(os.path.join(self._chromium_src, readme_path), 'r+') | 224 readme = open(os.path.join(self._chromium_src, readme_path), 'r+') |
| 225 txt = readme.read() | 225 txt = readme.read() |
| 226 m = re.sub(re.compile('.*^Revision\: ([0-9]*).*', re.MULTILINE), | 226 m = re.sub(re.compile('.*^Revision\: ([0-9]*).*', re.MULTILINE), |
| 227 ('Revision: %s' % new_revision), txt) | 227 ('Revision: %s' % new_revision), txt) |
| 228 readme.seek(0) | 228 readme.seek(0) |
| 229 readme.write(m) | 229 readme.write(m) |
| 230 readme.truncate() | 230 readme.truncate() |
| 231 | 231 |
| 232 def PrepareRoll(self, ignore_checks): | 232 def PrepareRoll(self, ignore_checks, skip_tryjobs): |
| 233 # TODO(kjellander): use os.path.normcase, os.path.join etc for all paths for | 233 # TODO(kjellander): use os.path.normcase, os.path.join etc for all paths for |
| 234 # cross platform compatibility. | 234 # cross platform compatibility. |
| 235 | 235 |
| 236 if not ignore_checks: | 236 if not ignore_checks: |
| 237 if self._GetCurrentBranchName() != 'master': | 237 if self._GetCurrentBranchName() != 'master': |
| 238 logging.error('Please checkout the master branch.') | 238 logging.error('Please checkout the master branch.') |
| 239 return -1 | 239 return -1 |
| 240 if not self._IsTreeClean(): | 240 if not self._IsTreeClean(): |
| 241 logging.error('Please make sure you don\'t have any modified files.') | 241 logging.error('Please make sure you don\'t have any modified files.') |
| 242 return -1 | 242 return -1 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 273 bugs = self._GetBugList(WEBGL_PATH, webgl_current, webgl_latest) | 273 bugs = self._GetBugList(WEBGL_PATH, webgl_current, webgl_latest) |
| 274 description = _GenerateCLDescriptionCommand( | 274 description = _GenerateCLDescriptionCommand( |
| 275 webgl_current, webgl_latest, bugs) | 275 webgl_current, webgl_latest, bugs) |
| 276 logging.debug('Committing changes locally.') | 276 logging.debug('Committing changes locally.') |
| 277 self._RunCommand(['git', 'add', '--update', '.']) | 277 self._RunCommand(['git', 'add', '--update', '.']) |
| 278 self._RunCommand(['git', 'commit'] + description) | 278 self._RunCommand(['git', 'commit'] + description) |
| 279 logging.debug('Uploading changes...') | 279 logging.debug('Uploading changes...') |
| 280 self._RunCommand(['git', 'cl', 'upload'], | 280 self._RunCommand(['git', 'cl', 'upload'], |
| 281 extra_env={'EDITOR': 'true'}) | 281 extra_env={'EDITOR': 'true'}) |
| 282 | 282 |
| 283 # Kick off tryjobs. | 283 if not skip_tryjobs: |
| 284 base_try_cmd = ['git', 'cl', 'try'] | 284 # Kick off tryjobs. |
| 285 self._RunCommand(base_try_cmd) | 285 base_try_cmd = ['git', 'cl', 'try'] |
| 286 | 286 self._RunCommand(base_try_cmd) |
| 287 if extra_trybots: | 287 if extra_trybots: |
| 288 # Run additional tryjobs. | 288 # Run additional tryjobs. |
| 289 # TODO(kbr): this should not be necessary -- the | 289 # TODO(kbr): this should not be necessary -- the |
| 290 # CQ_INCLUDE_TRYBOTS directive above should handle it. | 290 # CQ_INCLUDE_TRYBOTS directive above should handle it. |
| 291 # http://crbug.com/585237 | 291 # http://crbug.com/585237 |
| 292 for trybot in extra_trybots: | 292 for trybot in extra_trybots: |
| 293 for builder in trybot['buildernames']: | 293 for builder in trybot['buildernames']: |
| 294 self._RunCommand(base_try_cmd + [ | 294 self._RunCommand(base_try_cmd + [ |
| 295 '-m', trybot['mastername'], | 295 '-m', trybot['mastername'], |
| 296 '-b', builder]) | 296 '-b', builder]) |
| 297 | 297 |
| 298 cl_info = self._GetCLInfo() | 298 cl_info = self._GetCLInfo() |
| 299 print 'Issue: %d URL: %s' % (cl_info.issue, cl_info.url) | 299 print 'Issue: %d URL: %s' % (cl_info.issue, cl_info.url) |
| 300 | 300 |
| 301 # Checkout master again. | 301 # Checkout master again. |
| 302 self._RunCommand(['git', 'checkout', 'master']) | 302 self._RunCommand(['git', 'checkout', 'master']) |
| 303 print 'Roll branch left as ' + ROLL_BRANCH_NAME | 303 print 'Roll branch left as ' + ROLL_BRANCH_NAME |
| 304 return 0 | 304 return 0 |
| 305 | 305 |
| 306 def _UpdateDep(self, deps_filename, dep_relative_to_src, commit_info): | 306 def _UpdateDep(self, deps_filename, dep_relative_to_src, commit_info): |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 parser = argparse.ArgumentParser( | 358 parser = argparse.ArgumentParser( |
| 359 description='Auto-generates a CL containing a WebGL conformance roll.') | 359 description='Auto-generates a CL containing a WebGL conformance roll.') |
| 360 parser.add_argument('--abort', | 360 parser.add_argument('--abort', |
| 361 help=('Aborts a previously prepared roll. ' | 361 help=('Aborts a previously prepared roll. ' |
| 362 'Closes any associated issues and deletes the roll branches'), | 362 'Closes any associated issues and deletes the roll branches'), |
| 363 action='store_true') | 363 action='store_true') |
| 364 parser.add_argument('--ignore-checks', action='store_true', default=False, | 364 parser.add_argument('--ignore-checks', action='store_true', default=False, |
| 365 help=('Skips checks for being on the master branch, dirty workspaces and ' | 365 help=('Skips checks for being on the master branch, dirty workspaces and ' |
| 366 'the updating of the checkout. Will still delete and create local ' | 366 'the updating of the checkout. Will still delete and create local ' |
| 367 'Git branches.')) | 367 'Git branches.')) |
| 368 parser.add_argument('--skip-tryjobs', action='store_true', default=False, |
| 369 help=('Skip the dry-run tryjobs for the newly generated CL. Use this ' |
| 370 'when you expect to have to make many changes to the WebGL ' |
| 371 'conformance test expectations in the same CL and want to avoid ' |
| 372 'wasted tryjobs.')) |
| 368 parser.add_argument('-v', '--verbose', action='store_true', default=False, | 373 parser.add_argument('-v', '--verbose', action='store_true', default=False, |
| 369 help='Be extra verbose in printing of log messages.') | 374 help='Be extra verbose in printing of log messages.') |
| 370 args = parser.parse_args() | 375 args = parser.parse_args() |
| 371 | 376 |
| 372 if args.verbose: | 377 if args.verbose: |
| 373 logging.basicConfig(level=logging.DEBUG) | 378 logging.basicConfig(level=logging.DEBUG) |
| 374 else: | 379 else: |
| 375 logging.basicConfig(level=logging.ERROR) | 380 logging.basicConfig(level=logging.ERROR) |
| 376 | 381 |
| 377 autoroller = AutoRoller(SRC_DIR) | 382 autoroller = AutoRoller(SRC_DIR) |
| 378 if args.abort: | 383 if args.abort: |
| 379 return autoroller.Abort() | 384 return autoroller.Abort() |
| 380 else: | 385 else: |
| 381 return autoroller.PrepareRoll(args.ignore_checks) | 386 return autoroller.PrepareRoll(args.ignore_checks, args.skip_tryjobs) |
| 382 | 387 |
| 383 if __name__ == '__main__': | 388 if __name__ == '__main__': |
| 384 sys.exit(main()) | 389 sys.exit(main()) |
| OLD | NEW |