| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 parser.error('Need to pass a valid project to --project.\nOptions are: %s' % | 65 parser.error('Need to pass a valid project to --project.\nOptions are: %s' % |
| 66 ', '.join(project_choices)) | 66 ', '.join(project_choices)) |
| 67 if options.verbose: | 67 if options.verbose: |
| 68 level = logging.DEBUG | 68 level = logging.DEBUG |
| 69 else: | 69 else: |
| 70 level = logging.INFO | 70 level = logging.INFO |
| 71 logging.basicConfig( | 71 logging.basicConfig( |
| 72 level=level, | 72 level=level, |
| 73 format='%(asctime)s %(levelname)7s %(message)s') | 73 format='%(asctime)s %(levelname)7s %(message)s') |
| 74 root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'workdir') | 74 root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'workdir') |
| 75 if not os.path.isdir(root_dir): | 75 gaia_file = os.path.join(root_dir, '.gaia_pwd') |
| 76 os.makedirs(root_dir) | 76 if not os.path.isfile(gaia_file): |
| 77 | 77 parser.error('Please read workdir/README.') |
| 78 gaia_creds = creds.Credentials(os.path.join(root_dir, '.gaia_pwd')) | 78 gaia_creds = creds.Credentials(gaia_file) |
| 79 rietveld_obj = rietveld.Rietveld( | 79 rietveld_obj = rietveld.Rietveld( |
| 80 'http://codereview.chromium.org', | 80 'http://codereview.chromium.org', |
| 81 'commit-bot@chromium.org', | 81 'commit-bot@chromium.org', |
| 82 gaia_creds.get('commit-bot@chromium.org')) | 82 gaia_creds.get('commit-bot@chromium.org')) |
| 83 pc = projects.load_project(options.project, root_dir, rietveld_obj, | 83 pc = projects.load_project(options.project, root_dir, rietveld_obj, |
| 84 options.git_svn, options.no_try) | 84 options.git_svn, options.no_try) |
| 85 | 85 |
| 86 if options.dry_run: | 86 if options.dry_run: |
| 87 pc.checkout = checkout.ReadOnlyCheckout(pc.checkout) | 87 pc.checkout = checkout.ReadOnlyCheckout(pc.checkout) |
| 88 | 88 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 114 logging.info('Next poll in %1.1f second(s)' % delay) | 114 logging.info('Next poll in %1.1f second(s)' % delay) |
| 115 time.sleep(delay) | 115 time.sleep(delay) |
| 116 last_loop = time.time() | 116 last_loop = time.time() |
| 117 finally: | 117 finally: |
| 118 pc.save(db_path) | 118 pc.save(db_path) |
| 119 return 0 | 119 return 0 |
| 120 | 120 |
| 121 | 121 |
| 122 if __name__ == '__main__': | 122 if __name__ == '__main__': |
| 123 sys.exit(main()) | 123 sys.exit(main()) |
| OLD | NEW |