| OLD | NEW |
| 1 # Copyright (c) 2010 Google Inc. All rights reserved. | 1 # Copyright (c) 2010 Google Inc. All rights reserved. |
| 2 # Copyright (c) 2009 Apple Inc. All rights reserved. | 2 # Copyright (c) 2009 Apple Inc. All rights reserved. |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 # | 29 # |
| 30 # A tool for automating dealing with bugzilla, posting patches, committing patch
es, etc. | 30 # A tool for automating dealing with bugzilla, posting patches, committing patch
es, etc. |
| 31 | 31 |
| 32 from optparse import make_option | 32 from optparse import make_option |
| 33 | 33 |
| 34 from webkitpy.common.host import Host | 34 from webkitpy.common.host import Host |
| 35 from webkitpy.tool.multi_command_tool import MultiCommandTool | 35 from webkitpy.tool.multi_command_tool import MultiCommandTool |
| 36 | 36 from webkitpy.tool import commands |
| 37 from webkitpy.tool.commands.analyze_baselines import AnalyzeBaselines | |
| 38 from webkitpy.tool.commands.commit_announcer import CommitAnnouncerCommand | |
| 39 from webkitpy.tool.commands.flaky_tests import FlakyTests | |
| 40 from webkitpy.tool.commands.layout_tests_server import LayoutTestsServer | |
| 41 from webkitpy.tool.commands.pretty_diff import PrettyDiff | |
| 42 from webkitpy.tool.commands.queries import CrashLog | |
| 43 from webkitpy.tool.commands.queries import PrintBaselines | |
| 44 from webkitpy.tool.commands.queries import PrintExpectations | |
| 45 from webkitpy.tool.commands.rebaseline import AutoRebaseline | |
| 46 from webkitpy.tool.commands.rebaseline import CopyExistingBaselinesInternal | |
| 47 from webkitpy.tool.commands.rebaseline import OptimizeBaselines | |
| 48 from webkitpy.tool.commands.rebaseline import Rebaseline | |
| 49 from webkitpy.tool.commands.rebaseline import RebaselineExpectations | |
| 50 from webkitpy.tool.commands.rebaseline import RebaselineJson | |
| 51 from webkitpy.tool.commands.rebaseline import RebaselineTest | |
| 52 from webkitpy.tool.commands.rebaseline_server import RebaselineServer | |
| 53 | 37 |
| 54 | 38 |
| 55 class WebKitPatch(MultiCommandTool, Host): | 39 class WebKitPatch(MultiCommandTool, Host): |
| 56 global_options = [ | 40 global_options = [ |
| 57 make_option("-v", "--verbose", action="store_true", dest="verbose", defa
ult=False, help="enable all logging"), | 41 make_option("-v", "--verbose", action="store_true", dest="verbose", defa
ult=False, help="enable all logging"), |
| 58 make_option("-d", "--directory", action="append", dest="patch_directorie
s", | 42 make_option("-d", "--directory", action="append", dest="patch_directorie
s", |
| 59 default=[], help="Directory to look at for changed files"), | 43 default=[], help="Directory to look at for changed files"), |
| 60 ] | 44 ] |
| 61 | 45 |
| 62 def __init__(self, path): | 46 def __init__(self, path): |
| 63 MultiCommandTool.__init__(self) | 47 MultiCommandTool.__init__(self) |
| 64 Host.__init__(self) | 48 Host.__init__(self) |
| 65 self._path = path | 49 self._path = path |
| 66 self.commands = [ | |
| 67 AnalyzeBaselines(), | |
| 68 AutoRebaseline(), | |
| 69 CommitAnnouncerCommand(), | |
| 70 CopyExistingBaselinesInternal(), | |
| 71 CrashLog(), | |
| 72 FlakyTests(), | |
| 73 LayoutTestsServer(), | |
| 74 OptimizeBaselines(), | |
| 75 PrettyDiff(), | |
| 76 PrintBaselines(), | |
| 77 PrintExpectations(), | |
| 78 Rebaseline(), | |
| 79 RebaselineExpectations(), | |
| 80 RebaselineJson(), | |
| 81 RebaselineServer(), | |
| 82 RebaselineTest(), | |
| 83 ] | |
| 84 | 50 |
| 85 def path(self): | 51 def path(self): |
| 86 return self._path | 52 return self._path |
| 87 | 53 |
| 88 def should_show_in_main_help(self, command): | 54 def should_show_in_main_help(self, command): |
| 89 if not command.show_in_main_help: | 55 if not command.show_in_main_help: |
| 90 return False | 56 return False |
| 91 if command.requires_local_commits: | 57 if command.requires_local_commits: |
| 92 return self.scm().supports_local_commits() | 58 return self.scm().supports_local_commits() |
| 93 return True | 59 return True |
| 94 | 60 |
| 95 # FIXME: This may be unnecessary since we pass global options to all command
s during execute() as well. | 61 # FIXME: This may be unnecessary since we pass global options to all command
s during execute() as well. |
| 96 def handle_global_options(self, options): | 62 def handle_global_options(self, options): |
| 97 self.initialize_scm(options.patch_directories) | 63 self.initialize_scm(options.patch_directories) |
| 98 | 64 |
| 99 def should_execute_command(self, command): | 65 def should_execute_command(self, command): |
| 100 if command.requires_local_commits and not self.scm().supports_local_comm
its(): | 66 if command.requires_local_commits and not self.scm().supports_local_comm
its(): |
| 101 failure_reason = "%s requires local commits using %s in %s." % ( | 67 failure_reason = "%s requires local commits using %s in %s." % ( |
| 102 command.name, self.scm().display_name(), self.scm().checkout_roo
t) | 68 command.name, self.scm().display_name(), self.scm().checkout_roo
t) |
| 103 return (False, failure_reason) | 69 return (False, failure_reason) |
| 104 return (True, None) | 70 return (True, None) |
| OLD | NEW |