Bug 45838 - Command.tool should not need to be a WebKitPatch subclass
Summary: Command.tool should not need to be a WebKitPatch subclass
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-15 14:39 PDT by Eric Seidel (no email)
Modified: 2010-11-04 15:10 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2010-09-15 14:39:55 PDT
Command.tool should not need to be a WebKitPatch subclass

We need to break out a Tool subclass of WebKitPatch so that all the various commands which assume they have a self.tool.bugs, self.tool.scm, etc. can be run using something other than webkit-patch.

This should mostly just be moving code.  Adam started a patch to do this eons ago.

The end goal is to make it simple to create a new Tool, multi-command style or not.

For example, the following should be possible:

class MyTool(MultiCommandTool, Tool):
   pass

if __name__ == "__main__":
    MyTool().main()


We'd probably need to teach it things about what directory to search for commands in, or how to give it a specific set of commands.  We also eventually want to make it easy to create single-command tools.  The MultiCommandTool argument-parsing and command calling logic should just be a mix-in.  Tool is all the data storage.

Command.tool needs to be a "Tool" but does not need to be a MultiCommandTool.
Comment 1 Eric Seidel (no email) 2010-09-15 17:19:48 PDT
(In reply to comment #0)
> We need to break out a Tool subclass of WebKitPatch so that all the various commands which assume they have a self.tool.bugs, self.tool.scm, etc. can be run using something other than webkit-patch.

I actually meant "Steps" not Commands. I don't expect other tools will re-use webkit-patch Command objects, but they could.  Having a self.tool is pretty central to how the webkitpy command infrastructure works though.