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

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

Issue 2663623003: Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Remove second paragraph in comment about awesome windows git hack 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
68 global_options = [ 71 global_options = [
69 optparse.make_option( 72 optparse.make_option(
70 "-v", "--verbose", action="store_true", dest="verbose", default=Fals e, 73 "-v", "--verbose", action="store_true", dest="verbose", default=Fals e,
71 help="enable all logging"), 74 help="enable all logging"),
72 optparse.make_option( 75 optparse.make_option(
73 "-d", "--directory", action="append", default=[], 76 "-d", "--directory", action="append", default=[],
74 help="Directory to look at for changed files"), 77 help="Directory to look at for changed files"),
75 ] 78 ]
76 79
77 def __init__(self, path): 80 def __init__(self, path):
(...skipping 27 matching lines...) Expand all
105 108
106 option_parser = self._create_option_parser() 109 option_parser = self._create_option_parser()
107 self._add_global_options(option_parser) 110 self._add_global_options(option_parser)
108 111
109 command = self.command_by_name(command_name) or self.help_command 112 command = self.command_by_name(command_name) or self.help_command
110 if not command: 113 if not command:
111 option_parser.error("%s is not a recognized command", command_name) 114 option_parser.error("%s is not a recognized command", command_name)
112 115
113 command.set_option_parser(option_parser) 116 command.set_option_parser(option_parser)
114 (options, args) = command.parse_args(args) 117 (options, args) = command.parse_args(args)
115 self.initialize_scm()
116 118
117 (should_execute, failure_reason) = self._should_execute_command(command) 119 (should_execute, failure_reason) = self._should_execute_command(command)
118 if not should_execute: 120 if not should_execute:
119 _log.error(failure_reason) 121 _log.error(failure_reason)
120 return 0 # FIXME: Should this really be 0? 122 return 0 # FIXME: Should this really be 0?
121 123
122 result = command.check_arguments_and_execute(options, args, self) 124 result = command.check_arguments_and_execute(options, args, self)
123 return result 125 return result
124 126
125 def path(self): 127 def path(self):
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return False 166 return False
165 if command.requires_local_commits: 167 if command.requires_local_commits:
166 return self.scm().supports_local_commits() 168 return self.scm().supports_local_commits()
167 return True 169 return True
168 170
169 def command_by_name(self, command_name): 171 def command_by_name(self, command_name):
170 for command in self.commands: 172 for command in self.commands:
171 if command_name == command.name: 173 if command_name == command.name:
172 return command 174 return command
173 return None 175 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698