OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 """Client-side script to send a try job to the try server. It communicates to | 5 """Client-side script to send a try job to the try server. It communicates to |
6 the try server by either writting to a svn repository or by directly connecting | 6 the try server by either writting to a svn repository or by directly connecting |
7 to the server by HTTP. | 7 to the server by HTTP. |
8 """ | 8 """ |
9 | 9 |
10 import datetime | 10 import datetime |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 group.add_option("-S", "--svn_repo", | 596 group.add_option("-S", "--svn_repo", |
597 metavar="SVN_URL", | 597 metavar="SVN_URL", |
598 help="SVN url to use to write the changes in; --use_svn is " | 598 help="SVN url to use to write the changes in; --use_svn is " |
599 "implied when using --svn_repo") | 599 "implied when using --svn_repo") |
600 parser.add_option_group(group) | 600 parser.add_option_group(group) |
601 | 601 |
602 options, args = parser.parse_args(argv) | 602 options, args = parser.parse_args(argv) |
603 if len(args) == 1 and args[0] == 'help': | 603 if len(args) == 1 and args[0] == 'help': |
604 parser.print_help() | 604 parser.print_help() |
605 | 605 |
| 606 LOG_FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s' |
606 if not swallow_exception: | 607 if not swallow_exception: |
607 if options.verbose == 0: | 608 if options.verbose == 0: |
608 logging.basicConfig(level=logging.WARNING) | 609 logging.basicConfig(level=logging.WARNING, format=LOG_FORMAT) |
609 elif options.verbose == 1: | 610 elif options.verbose == 1: |
610 logging.basicConfig(level=logging.INFO) | 611 logging.basicConfig(level=logging.INFO, format=LOG_FORMAT) |
611 elif options.verbose > 1: | 612 elif options.verbose > 1: |
612 logging.basicConfig(level=logging.DEBUG) | 613 logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT) |
613 | 614 |
614 logging.debug(argv) | 615 logging.debug(argv) |
615 | 616 |
616 # Strip off any @ in the user, otherwise svn gets confused. | 617 # Strip off any @ in the user, otherwise svn gets confused. |
617 options.user = options.user.split('@', 1)[0] | 618 options.user = options.user.split('@', 1)[0] |
618 | 619 |
619 if options.rietveld_url: | 620 if options.rietveld_url: |
620 # Try to extract the review number if possible and fix the protocol. | 621 # Try to extract the review number if possible and fix the protocol. |
621 if not '://' in options.rietveld_url: | 622 if not '://' in options.rietveld_url: |
622 options.rietveld_url = 'http://' + options.rietveld_url | 623 options.rietveld_url = 'http://' + options.rietveld_url |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 except (InvalidScript, NoTryServerAccess), e: | 736 except (InvalidScript, NoTryServerAccess), e: |
736 if swallow_exception: | 737 if swallow_exception: |
737 return 1 | 738 return 1 |
738 print e | 739 print e |
739 return 1 | 740 return 1 |
740 return 0 | 741 return 0 |
741 | 742 |
742 | 743 |
743 if __name__ == "__main__": | 744 if __name__ == "__main__": |
744 sys.exit(TryChange(None, [], False)) | 745 sys.exit(TryChange(None, [], False)) |
OLD | NEW |