| 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 |
| 11 import logging | 11 import logging |
| 12 import logging.handlers | 12 import logging.handlers |
| 13 import optparse | 13 import optparse |
| 14 import os | 14 import os |
| 15 import shutil | 15 import shutil |
| 16 import signal | 16 import signal |
| 17 import socket |
| 17 import sys | 18 import sys |
| 18 import tempfile | 19 import tempfile |
| 19 import time | 20 import time |
| 20 | 21 |
| 21 import find_depot_tools # pylint: disable=W0611 | 22 import find_depot_tools # pylint: disable=W0611 |
| 22 import checkout | 23 import checkout |
| 23 import fix_encoding | 24 import fix_encoding |
| 24 import rietveld | 25 import rietveld |
| 25 import subprocess2 | 26 import subprocess2 |
| 26 | 27 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 dir=os.path.dirname(db_path), | 140 dir=os.path.dirname(db_path), |
| 140 prefix='db.debug.', | 141 prefix='db.debug.', |
| 141 suffix='.json', | 142 suffix='.json', |
| 142 delete=False) as tmp_file: | 143 delete=False) as tmp_file: |
| 143 with open(db_path) as db_file: | 144 with open(db_path) as db_file: |
| 144 shutil.copyfileobj(db_file, tmp_file) | 145 shutil.copyfileobj(db_file, tmp_file) |
| 145 return tmp_file.name | 146 return tmp_file.name |
| 146 | 147 |
| 147 | 148 |
| 148 def main(): | 149 def main(): |
| 150 # Set a default timeout for sockets. This is critical when talking to remote |
| 151 # services like AppEngine and buildbot. |
| 152 socket.setdefaulttimeout(70.0) |
| 153 |
| 149 parser = optparse.OptionParser( | 154 parser = optparse.OptionParser( |
| 150 description=sys.modules['__main__'].__doc__) | 155 description=sys.modules['__main__'].__doc__) |
| 151 project_choices = projects.supported_projects() | 156 project_choices = projects.supported_projects() |
| 152 parser.add_option('-v', '--verbose', action='store_true') | 157 parser.add_option('-v', '--verbose', action='store_true') |
| 153 parser.add_option( | 158 parser.add_option( |
| 154 '--no-dry-run', | 159 '--no-dry-run', |
| 155 action='store_false', | 160 action='store_false', |
| 156 dest='dry_run', | 161 dest='dry_run', |
| 157 default=True, | 162 default=True, |
| 158 help='Run for real instead of dry-run mode which is the default. ' | 163 help='Run for real instead of dry-run mode which is the default. ' |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 # CQ generally doesn't exit by itself, but if we ever get here, it looks | 385 # CQ generally doesn't exit by itself, but if we ever get here, it looks |
| 381 # like a clean shutdown so remove the landmine file. | 386 # like a clean shutdown so remove the landmine file. |
| 382 # TODO(phajdan.jr): Do we ever get here? | 387 # TODO(phajdan.jr): Do we ever get here? |
| 383 os.remove(landmine_path) | 388 os.remove(landmine_path) |
| 384 return 0 | 389 return 0 |
| 385 | 390 |
| 386 | 391 |
| 387 if __name__ == '__main__': | 392 if __name__ == '__main__': |
| 388 fix_encoding.fix_encoding() | 393 fix_encoding.fix_encoding() |
| 389 sys.exit(main()) | 394 sys.exit(main()) |
| OLD | NEW |