| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 class WebKitPatch(Host): | 67 class WebKitPatch(Host): |
| 68 global_options = [ | 68 global_options = [ |
| 69 optparse.make_option( | 69 optparse.make_option( |
| 70 "-v", "--verbose", action="store_true", dest="verbose", default=Fals
e, | 70 "-v", "--verbose", action="store_true", dest="verbose", default=Fals
e, |
| 71 help="enable all logging"), | 71 help="enable all logging"), |
| 72 optparse.make_option( | 72 optparse.make_option( |
| 73 "-d", "--directory", action="append", dest="patch_directories", defa
ult=[], | 73 "-d", "--directory", action="append", dest="patch_directories", defa
ult=[], |
| 74 help="Directory to look at for changed files"), | 74 help="Directory to look at for changed files"), |
| 75 ] | 75 ] |
| 76 | 76 |
| 77 def __init__(self): | 77 def __init__(self, path): |
| 78 super(WebKitPatch, self).__init__() | 78 super(WebKitPatch, self).__init__() |
| 79 self._path = path |
| 79 self.commands = [ | 80 self.commands = [ |
| 80 AnalyzeBaselines(), | 81 AnalyzeBaselines(), |
| 81 AutoRebaseline(), | 82 AutoRebaseline(), |
| 82 CommitAnnouncerCommand(), | 83 CommitAnnouncerCommand(), |
| 83 CopyExistingBaselinesInternal(), | 84 CopyExistingBaselinesInternal(), |
| 84 CrashLog(), | 85 CrashLog(), |
| 85 FlakyTests(), | 86 FlakyTests(), |
| 86 LayoutTestsServer(), | 87 LayoutTestsServer(), |
| 87 OptimizeBaselines(), | 88 OptimizeBaselines(), |
| 88 PrettyDiff(), | 89 PrettyDiff(), |
| (...skipping 29 matching lines...) Expand all Loading... |
| 118 self._handle_global_options(options) | 119 self._handle_global_options(options) |
| 119 | 120 |
| 120 (should_execute, failure_reason) = self._should_execute_command(command) | 121 (should_execute, failure_reason) = self._should_execute_command(command) |
| 121 if not should_execute: | 122 if not should_execute: |
| 122 _log.error(failure_reason) | 123 _log.error(failure_reason) |
| 123 return 0 # FIXME: Should this really be 0? | 124 return 0 # FIXME: Should this really be 0? |
| 124 | 125 |
| 125 result = command.check_arguments_and_execute(options, args, self) | 126 result = command.check_arguments_and_execute(options, args, self) |
| 126 return result | 127 return result |
| 127 | 128 |
| 129 def path(self): |
| 130 return self._path |
| 131 |
| 128 @staticmethod | 132 @staticmethod |
| 129 def _split_command_name_from_args(args): | 133 def _split_command_name_from_args(args): |
| 130 # Assume the first argument which doesn't start with "-" is the command
name. | 134 # Assume the first argument which doesn't start with "-" is the command
name. |
| 131 command_index = 0 | 135 command_index = 0 |
| 132 for arg in args: | 136 for arg in args: |
| 133 if arg[0] != "-": | 137 if arg[0] != "-": |
| 134 break | 138 break |
| 135 command_index += 1 | 139 command_index += 1 |
| 136 else: | 140 else: |
| 137 return (None, args[:]) | 141 return (None, args[:]) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 168 return False | 172 return False |
| 169 if command.requires_local_commits: | 173 if command.requires_local_commits: |
| 170 return self.scm().supports_local_commits() | 174 return self.scm().supports_local_commits() |
| 171 return True | 175 return True |
| 172 | 176 |
| 173 def command_by_name(self, command_name): | 177 def command_by_name(self, command_name): |
| 174 for command in self.commands: | 178 for command in self.commands: |
| 175 if command_name == command.name: | 179 if command_name == command.name: |
| 176 return command | 180 return command |
| 177 return None | 181 return None |
| OLD | NEW |