| 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 from webkitpy.tool import commands | 36 |
| 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 |
| 37 | 53 |
| 38 | 54 |
| 39 class WebKitPatch(MultiCommandTool, Host): | 55 class WebKitPatch(MultiCommandTool, Host): |
| 40 global_options = [ | 56 global_options = [ |
| 41 make_option("-v", "--verbose", action="store_true", dest="verbose", defa
ult=False, help="enable all logging"), | 57 make_option("-v", "--verbose", action="store_true", dest="verbose", defa
ult=False, help="enable all logging"), |
| 42 make_option("-d", "--directory", action="append", dest="patch_directorie
s", | 58 make_option("-d", "--directory", action="append", dest="patch_directorie
s", |
| 43 default=[], help="Directory to look at for changed files"), | 59 default=[], help="Directory to look at for changed files"), |
| 44 ] | 60 ] |
| 45 | 61 |
| 46 def __init__(self, path): | 62 def __init__(self, path): |
| 47 MultiCommandTool.__init__(self) | 63 MultiCommandTool.__init__(self, commands=[ |
| 64 AnalyzeBaselines(), |
| 65 AutoRebaseline(), |
| 66 CommitAnnouncerCommand(), |
| 67 CopyExistingBaselinesInternal(), |
| 68 CrashLog(), |
| 69 FlakyTests(), |
| 70 LayoutTestsServer(), |
| 71 OptimizeBaselines(), |
| 72 PrettyDiff(), |
| 73 PrintBaselines(), |
| 74 PrintExpectations(), |
| 75 Rebaseline(), |
| 76 RebaselineExpectations(), |
| 77 RebaselineJson(), |
| 78 RebaselineServer(), |
| 79 RebaselineTest(), |
| 80 ]) |
| 48 Host.__init__(self) | 81 Host.__init__(self) |
| 49 self._path = path | 82 self._path = path |
| 50 | 83 |
| 51 def path(self): | 84 def path(self): |
| 52 return self._path | 85 return self._path |
| 53 | 86 |
| 54 def should_show_in_main_help(self, command): | 87 def should_show_in_main_help(self, command): |
| 55 if not command.show_in_main_help: | 88 if not command.show_in_main_help: |
| 56 return False | 89 return False |
| 57 if command.requires_local_commits: | 90 if command.requires_local_commits: |
| 58 return self.scm().supports_local_commits() | 91 return self.scm().supports_local_commits() |
| 59 return True | 92 return True |
| 60 | 93 |
| 61 # FIXME: This may be unnecessary since we pass global options to all command
s during execute() as well. | 94 # FIXME: This may be unnecessary since we pass global options to all command
s during execute() as well. |
| 62 def handle_global_options(self, options): | 95 def handle_global_options(self, options): |
| 63 self.initialize_scm(options.patch_directories) | 96 self.initialize_scm(options.patch_directories) |
| 64 | 97 |
| 65 def should_execute_command(self, command): | 98 def should_execute_command(self, command): |
| 66 if command.requires_local_commits and not self.scm().supports_local_comm
its(): | 99 if command.requires_local_commits and not self.scm().supports_local_comm
its(): |
| 67 failure_reason = "%s requires local commits using %s in %s." % ( | 100 failure_reason = "%s requires local commits using %s in %s." % ( |
| 68 command.name, self.scm().display_name(), self.scm().checkout_roo
t) | 101 command.name, self.scm().display_name(), self.scm().checkout_roo
t) |
| 69 return (False, failure_reason) | 102 return (False, failure_reason) |
| 70 return (True, None) | 103 return (True, None) |
| OLD | NEW |