Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py

Issue 2671583002: Revert of Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 from webkitpy.tool.commands.rebaseline import RebaselineJson 58 from webkitpy.tool.commands.rebaseline import RebaselineJson
59 from webkitpy.tool.commands.rebaseline import RebaselineTest 59 from webkitpy.tool.commands.rebaseline import RebaselineTest
60 from webkitpy.tool.commands.rebaseline_cl import RebaselineCL 60 from webkitpy.tool.commands.rebaseline_cl import RebaselineCL
61 from webkitpy.tool.commands.rebaseline_server import RebaselineServer 61 from webkitpy.tool.commands.rebaseline_server import RebaselineServer
62 62
63 63
64 _log = logging.getLogger(__name__) 64 _log = logging.getLogger(__name__)
65 65
66 66
67 class WebKitPatch(Host): 67 class WebKitPatch(Host):
68 # FIXME: It might make more sense if this class had a Host attribute
69 # instead of being a Host subclass.
70
71 global_options = [ 68 global_options = [
72 optparse.make_option( 69 optparse.make_option(
73 "-v", "--verbose", action="store_true", dest="verbose", default=Fals e, 70 "-v", "--verbose", action="store_true", dest="verbose", default=Fals e,
74 help="enable all logging"), 71 help="enable all logging"),
75 optparse.make_option( 72 optparse.make_option(
76 "-d", "--directory", action="append", default=[], 73 "-d", "--directory", action="append", default=[],
77 help="Directory to look at for changed files"), 74 help="Directory to look at for changed files"),
78 ] 75 ]
79 76
80 def __init__(self, path): 77 def __init__(self, path):
(...skipping 27 matching lines...) Expand all
108 105
109 option_parser = self._create_option_parser() 106 option_parser = self._create_option_parser()
110 self._add_global_options(option_parser) 107 self._add_global_options(option_parser)
111 108
112 command = self.command_by_name(command_name) or self.help_command 109 command = self.command_by_name(command_name) or self.help_command
113 if not command: 110 if not command:
114 option_parser.error("%s is not a recognized command", command_name) 111 option_parser.error("%s is not a recognized command", command_name)
115 112
116 command.set_option_parser(option_parser) 113 command.set_option_parser(option_parser)
117 (options, args) = command.parse_args(args) 114 (options, args) = command.parse_args(args)
115 self.initialize_scm()
118 116
119 (should_execute, failure_reason) = self._should_execute_command(command) 117 (should_execute, failure_reason) = self._should_execute_command(command)
120 if not should_execute: 118 if not should_execute:
121 _log.error(failure_reason) 119 _log.error(failure_reason)
122 return 0 # FIXME: Should this really be 0? 120 return 0 # FIXME: Should this really be 0?
123 121
124 result = command.check_arguments_and_execute(options, args, self) 122 result = command.check_arguments_and_execute(options, args, self)
125 return result 123 return result
126 124
127 def path(self): 125 def path(self):
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return False 164 return False
167 if command.requires_local_commits: 165 if command.requires_local_commits:
168 return self.scm().supports_local_commits() 166 return self.scm().supports_local_commits()
169 return True 167 return True
170 168
171 def command_by_name(self, command_name): 169 def command_by_name(self, command_name):
172 for command in self.commands: 170 for command in self.commands:
173 if command_name == command.name: 171 if command_name == command.name:
174 return command 172 return command
175 return None 173 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698