| 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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 group.add_option("--root", | 540 group.add_option("--root", |
| 541 help="Root to use for the patch; base subdirectory for " | 541 help="Root to use for the patch; base subdirectory for " |
| 542 "patch created in a subdirectory") | 542 "patch created in a subdirectory") |
| 543 group.add_option("-p", "--patchlevel", type='int', metavar="LEVEL", | 543 group.add_option("-p", "--patchlevel", type='int', metavar="LEVEL", |
| 544 help="Used as -pN parameter to patch") | 544 help="Used as -pN parameter to patch") |
| 545 group.add_option("-s", "--sub_rep", action="append", default=[], | 545 group.add_option("-s", "--sub_rep", action="append", default=[], |
| 546 help="Subcheckout to use in addition. This is mainly " | 546 help="Subcheckout to use in addition. This is mainly " |
| 547 "useful for gclient-style checkouts. Use @rev or " | 547 "useful for gclient-style checkouts. Use @rev or " |
| 548 "@branch or @branch1..branch2 to specify the " | 548 "@branch or @branch1..branch2 to specify the " |
| 549 "revision/branch to diff against.") | 549 "revision/branch to diff against.") |
| 550 # Mostly chromium-specific | |
| 551 try: | |
| 552 def WebKitRevision(options, opt, value, parser): | |
| 553 if not hasattr(options, 'sub_rep'): | |
| 554 options.sub_rep = [] | |
| 555 if parser.rargs and not parser.rargs[0].startswith('-'): | |
| 556 options.sub_rep.append('third_party/WebKit@%s' % parser.rargs.pop(0)) | |
| 557 else: | |
| 558 options.sub_rep.append('third_party/WebKit') | |
| 559 | |
| 560 group.add_option("-W", "--webkit", action="callback", | |
| 561 callback=WebKitRevision, | |
| 562 metavar="BRANCH", | |
| 563 help="Shorthand for -s third_party/WebKit@BRANCH. " | |
| 564 "BRANCH is optional and is the branch the current " | |
| 565 "checkout will be diff'ed against.") | |
| 566 except optparse.OptionError: | |
| 567 # append_const is not supported on 2.4. Too bad. | |
| 568 pass | |
| 569 group.add_option("--no_gclient", action="store_true", | 550 group.add_option("--no_gclient", action="store_true", |
| 570 help="Disable automatic search for gclient checkout.") | 551 help="Disable automatic search for gclient checkout.") |
| 571 group.add_option("-E", "--exclude", action="append", | 552 group.add_option("-E", "--exclude", action="append", |
| 572 default=['ChangeLog'], metavar='REGEXP', | 553 default=['ChangeLog'], metavar='REGEXP', |
| 573 help="Regexp patterns to exclude files. Default: %default") | 554 help="Regexp patterns to exclude files. Default: %default") |
| 574 parser.add_option_group(group) | 555 parser.add_option_group(group) |
| 575 | 556 |
| 576 group = optparse.OptionGroup(parser, "Access the try server by HTTP") | 557 group = optparse.OptionGroup(parser, "Access the try server by HTTP") |
| 577 group.add_option("--use_http", | 558 group.add_option("--use_http", |
| 578 action="store_const", | 559 action="store_const", |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 except (InvalidScript, NoTryServerAccess), e: | 733 except (InvalidScript, NoTryServerAccess), e: |
| 753 if swallow_exception: | 734 if swallow_exception: |
| 754 return 1 | 735 return 1 |
| 755 print e | 736 print e |
| 756 return 1 | 737 return 1 |
| 757 return 0 | 738 return 0 |
| 758 | 739 |
| 759 | 740 |
| 760 if __name__ == "__main__": | 741 if __name__ == "__main__": |
| 761 sys.exit(TryChange(None, [], False)) | 742 sys.exit(TryChange(None, [], False)) |
| OLD | NEW |