| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Commit queue executable. | 5 """Commit queue executable. |
| 6 | 6 |
| 7 Reuse Rietveld and the Chromium Try Server to process and automatically commit | 7 Reuse Rietveld and the Chromium Try Server to process and automatically commit |
| 8 patches. | 8 patches. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 parser.add_option( | 191 parser.add_option( |
| 192 '--project', | 192 '--project', |
| 193 choices=project_choices, | 193 choices=project_choices, |
| 194 help='Project to run the commit queue against: %s' % | 194 help='Project to run the commit queue against: %s' % |
| 195 ', '.join(project_choices)) | 195 ', '.join(project_choices)) |
| 196 parser.add_option( | 196 parser.add_option( |
| 197 '-u', | 197 '-u', |
| 198 '--user', | 198 '--user', |
| 199 default='commit-bot@chromium.org', | 199 default='commit-bot@chromium.org', |
| 200 help='User to use instead of %default') | 200 help='User to use instead of %default') |
| 201 parser.add_option( |
| 202 '--rietveld', |
| 203 default='https://codereview.chromium.org', |
| 204 help='Rietveld server to use instead of %default') |
| 201 options, args = parser.parse_args() | 205 options, args = parser.parse_args() |
| 202 if args: | 206 if args: |
| 203 parser.error('Unsupported args: %s' % args) | 207 parser.error('Unsupported args: %s' % args) |
| 204 if not options.project: | 208 if not options.project: |
| 205 parser.error('Need to pass a valid project to --project.\nOptions are: %s' % | 209 parser.error('Need to pass a valid project to --project.\nOptions are: %s' % |
| 206 ', '.join(project_choices)) | 210 ', '.join(project_choices)) |
| 207 | 211 |
| 208 SetupLogging(options) | 212 SetupLogging(options) |
| 209 try: | 213 try: |
| 210 work_dir = os.path.join(ROOT_DIR, 'workdir') | 214 work_dir = os.path.join(ROOT_DIR, 'workdir') |
| 211 # Use our specific subversion config. | 215 # Use our specific subversion config. |
| 212 checkout.SvnMixIn.svn_config = checkout.SvnConfig( | 216 checkout.SvnMixIn.svn_config = checkout.SvnConfig( |
| 213 os.path.join(ROOT_DIR, 'subversion_config')) | 217 os.path.join(ROOT_DIR, 'subversion_config')) |
| 214 | 218 |
| 215 url = 'https://codereview.chromium.org' | 219 url = options.rietveld |
| 216 gaia_creds = creds.Credentials(os.path.join(work_dir, '.gaia_pwd')) | 220 gaia_creds = creds.Credentials(os.path.join(work_dir, '.gaia_pwd')) |
| 217 if options.dry_run: | 221 if options.dry_run: |
| 218 logging.debug('Dry run - skipping SCM check.') | 222 logging.debug('Dry run - skipping SCM check.') |
| 219 if options.only_issue: | 223 if options.only_issue: |
| 220 parser.error('--only-issue is not supported with dry run') | 224 parser.error('--only-issue is not supported with dry run') |
| 221 else: | 225 else: |
| 222 print('Using read-only Rietveld') | 226 print('Using read-only Rietveld') |
| 223 # Make sure rietveld is not modified. | 227 # Make sure rietveld is not modified. |
| 224 rietveld_obj = rietveld.ReadOnlyRietveld( | 228 rietveld_obj = rietveld.ReadOnlyRietveld( |
| 225 url, | 229 url, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 # CQ generally doesn't exit by itself, but if we ever get here, it looks | 390 # CQ generally doesn't exit by itself, but if we ever get here, it looks |
| 387 # like a clean shutdown so remove the landmine file. | 391 # like a clean shutdown so remove the landmine file. |
| 388 # TODO(phajdan.jr): Do we ever get here? | 392 # TODO(phajdan.jr): Do we ever get here? |
| 389 os.remove(landmine_path) | 393 os.remove(landmine_path) |
| 390 return 0 | 394 return 0 |
| 391 | 395 |
| 392 | 396 |
| 393 if __name__ == '__main__': | 397 if __name__ == '__main__': |
| 394 fix_encoding.fix_encoding() | 398 fix_encoding.fix_encoding() |
| 395 sys.exit(main()) | 399 sys.exit(main()) |
| OLD | NEW |