Changeset 148360 in webkit


Ignore:
Timestamp:
Apr 13, 2013 10:39:30 AM (11 years ago)
Author:
rniwa@webkit.org
Message:

Merge AbstractDeclarativeCommand into Command as a comment suggests
https://bugs.webkit.org/show_bug.cgi?id=114559

Reviewed by Antti Koivisto.

Merged two classes as the comment right above AbstractDeclarativeCommand suggested.
We need to merge a lot more classes to make webkitpy hackable.

  • Scripts/webkitpy/tool/commands/abstractlocalservercommand.py:

(AbstractLocalServerCommand):
(AbstractLocalServerCommand.init):

  • Scripts/webkitpy/tool/commands/abstractsequencedcommand.py:

(AbstractSequencedCommand):
(AbstractSequencedCommand.init):

  • Scripts/webkitpy/tool/commands/adduserstogroups.py:

(AddUsersToGroups):

  • Scripts/webkitpy/tool/commands/analyzechangelog.py:

(AnalyzeChangeLog):
(AnalyzeChangeLog.init):

  • Scripts/webkitpy/tool/commands/analyzechangelog_unittest.py:
  • Scripts/webkitpy/tool/commands/bugfortest.py:

(BugForTest):

  • Scripts/webkitpy/tool/commands/bugsearch.py:

(BugSearch):

  • Scripts/webkitpy/tool/commands/chromechannels.py:

(ChromeChannels):
(init):

  • Scripts/webkitpy/tool/commands/download.py:

(AbstractPatchProcessingCommand):

  • Scripts/webkitpy/tool/commands/findusers.py:

(FindUsers):

  • Scripts/webkitpy/tool/commands/openbugs.py:

(OpenBugs):

  • Scripts/webkitpy/tool/commands/queries.py:

(BugsToCommit):
(PatchesInCommitQueue):
(PatchesToCommitQueue):
(PatchesToCommitQueue.init):
(PatchesToReview):
(PatchesToReview.init):
(PatchesToReview.execute):
(WhatBroke):
(ResultsFor):
(FailureReason):
(FindFlakyTests):
(TreeStatus):
(CrashLog):
(PrintExpectations):
(PrintExpectations.init):
(PrintBaselines):
(PrintBaselines.init):

  • Scripts/webkitpy/tool/commands/queues.py:

(AbstractQueue.init):

  • Scripts/webkitpy/tool/commands/rebaseline.py:

(AbstractRebaseliningCommand):

  • Scripts/webkitpy/tool/commands/suggestnominations.py:

(SuggestNominations):
(SuggestNominations.init):

  • Scripts/webkitpy/tool/commands/upload.py:

(CommitMessageForCurrentDiff):
(CommitMessageForCurrentDiff.init):
(CleanPendingCommit):
(CleanReviewQueue):
(AssignToCommitter):
(PostCommits):
(PostCommits.init):
(MarkBugFixed):
(MarkBugFixed.init):
(CreateBug):
(CreateBug.init):

  • Scripts/webkitpy/tool/multicommandtool.py:

(Command):
(Command.init):
(Command.main):
(HelpCommand):
(HelpCommand.init):

  • Scripts/webkitpy/tool/multicommandtool_unittest.py:

(TrivialCommand):
(TrivialCommand.init):
(LikesToRetry):
(LikesToRetry.init):
(CommandTest.test_name_with_arguments):
(CommandTest.test_required_arguments):
(test_command_help):

Location:
trunk/Tools
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r148355 r148360  
     12013-04-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Merge AbstractDeclarativeCommand into Command as a comment suggests
     4        https://bugs.webkit.org/show_bug.cgi?id=114559
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Merged two classes as the comment right above AbstractDeclarativeCommand suggested.
     9        We need to merge a lot more classes to make webkitpy hackable.
     10
     11        * Scripts/webkitpy/tool/commands/abstractlocalservercommand.py:
     12        (AbstractLocalServerCommand):
     13        (AbstractLocalServerCommand.__init__):
     14        * Scripts/webkitpy/tool/commands/abstractsequencedcommand.py:
     15        (AbstractSequencedCommand):
     16        (AbstractSequencedCommand.__init__):
     17        * Scripts/webkitpy/tool/commands/adduserstogroups.py:
     18        (AddUsersToGroups):
     19        * Scripts/webkitpy/tool/commands/analyzechangelog.py:
     20        (AnalyzeChangeLog):
     21        (AnalyzeChangeLog.__init__):
     22        * Scripts/webkitpy/tool/commands/analyzechangelog_unittest.py:
     23        * Scripts/webkitpy/tool/commands/bugfortest.py:
     24        (BugForTest):
     25        * Scripts/webkitpy/tool/commands/bugsearch.py:
     26        (BugSearch):
     27        * Scripts/webkitpy/tool/commands/chromechannels.py:
     28        (ChromeChannels):
     29        (__init__):
     30        * Scripts/webkitpy/tool/commands/download.py:
     31        (AbstractPatchProcessingCommand):
     32        * Scripts/webkitpy/tool/commands/findusers.py:
     33        (FindUsers):
     34        * Scripts/webkitpy/tool/commands/openbugs.py:
     35        (OpenBugs):
     36        * Scripts/webkitpy/tool/commands/queries.py:
     37        (BugsToCommit):
     38        (PatchesInCommitQueue):
     39        (PatchesToCommitQueue):
     40        (PatchesToCommitQueue.__init__):
     41        (PatchesToReview):
     42        (PatchesToReview.__init__):
     43        (PatchesToReview.execute):
     44        (WhatBroke):
     45        (ResultsFor):
     46        (FailureReason):
     47        (FindFlakyTests):
     48        (TreeStatus):
     49        (CrashLog):
     50        (PrintExpectations):
     51        (PrintExpectations.__init__):
     52        (PrintBaselines):
     53        (PrintBaselines.__init__):
     54        * Scripts/webkitpy/tool/commands/queues.py:
     55        (AbstractQueue.__init__):
     56        * Scripts/webkitpy/tool/commands/rebaseline.py:
     57        (AbstractRebaseliningCommand):
     58        * Scripts/webkitpy/tool/commands/suggestnominations.py:
     59        (SuggestNominations):
     60        (SuggestNominations.__init__):
     61        * Scripts/webkitpy/tool/commands/upload.py:
     62        (CommitMessageForCurrentDiff):
     63        (CommitMessageForCurrentDiff.__init__):
     64        (CleanPendingCommit):
     65        (CleanReviewQueue):
     66        (AssignToCommitter):
     67        (PostCommits):
     68        (PostCommits.__init__):
     69        (MarkBugFixed):
     70        (MarkBugFixed.__init__):
     71        (CreateBug):
     72        (CreateBug.__init__):
     73        * Scripts/webkitpy/tool/multicommandtool.py:
     74        (Command):
     75        (Command.__init__):
     76        (Command.main):
     77        (HelpCommand):
     78        (HelpCommand.__init__):
     79        * Scripts/webkitpy/tool/multicommandtool_unittest.py:
     80        (TrivialCommand):
     81        (TrivialCommand.__init__):
     82        (LikesToRetry):
     83        (LikesToRetry.__init__):
     84        (CommandTest.test_name_with_arguments):
     85        (CommandTest.test_required_arguments):
     86        (test_command_help):
     87
    1882013-04-13  Ed Bartosh  <bartosh@gmail.com>
    289
  • trunk/Tools/Scripts/webkitpy/tool/commands/abstractlocalservercommand.py

    r140508 r148360  
    2626import threading
    2727
    28 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     28from webkitpy.tool.multicommandtool import Command
    2929
    3030
    31 class AbstractLocalServerCommand(AbstractDeclarativeCommand):
     31class AbstractLocalServerCommand(Command):
    3232    server = None
    3333    launch_path = "/"
     
    3838            make_option("--no-show-results", action="store_false", default=True, dest="show_results", help="Don't launch a browser with the rebaseline server"),
    3939        ]
    40         AbstractDeclarativeCommand.__init__(self, options=options)
     40        Command.__init__(self, options=options)
    4141
    4242    def _prepare_config(self, options, args, tool):
  • trunk/Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py

    r135744 r148360  
    3131from webkitpy.common.system.executive import ScriptError
    3232from webkitpy.tool.commands.stepsequence import StepSequence
    33 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     33from webkitpy.tool.multicommandtool import Command
    3434
    3535_log = logging.getLogger(__name__)
    3636
    3737
    38 class AbstractSequencedCommand(AbstractDeclarativeCommand):
     38class AbstractSequencedCommand(Command):
    3939    steps = None
    4040    def __init__(self):
    4141        self._sequence = StepSequence(self.steps)
    42         AbstractDeclarativeCommand.__init__(self, self._sequence.options())
     42        Command.__init__(self, self._sequence.options())
    4343
    4444    def _prepare_state(self, options, args, tool):
  • trunk/Tools/Scripts/webkitpy/tool/commands/adduserstogroups.py

    r95238 r148360  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     29from webkitpy.tool.multicommandtool import Command
    3030
    3131
    32 class AddUsersToGroups(AbstractDeclarativeCommand):
     32class AddUsersToGroups(Command):
    3333    name = "add-users-to-groups"
    3434    help_text = "Add users matching subtring to specified groups"
  • trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog.py

    r107136 r148360  
    3636from webkitpy.common.system.filesystem import FileSystem
    3737from webkitpy.common.system.executive import Executive
    38 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     38from webkitpy.tool.multicommandtool import Command
    3939from webkitpy.tool import steps
    4040
    4141
    42 class AnalyzeChangeLog(AbstractDeclarativeCommand):
     42class AnalyzeChangeLog(Command):
    4343    name = "analyze-changelog"
    4444    help_text = "Experimental command for analyzing change logs."
     
    4949            steps.Options.changelog_count,
    5050        ]
    51         AbstractDeclarativeCommand.__init__(self, options=options)
     51        Command.__init__(self, options=options)
    5252
    5353    @staticmethod
  • trunk/Tools/Scripts/webkitpy/tool/commands/analyzechangelog_unittest.py

    r103959 r148360  
    3737from webkitpy.tool.commands.analyzechangelog import ChangeLogAnalyzer
    3838from webkitpy.tool.commands.commandtest import CommandsTest
    39 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     39from webkitpy.tool.multicommandtool import Command
    4040
    4141
  • trunk/Tools/Scripts/webkitpy/tool/commands/bugfortest.py

    r74138 r148360  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     29from webkitpy.tool.multicommandtool import Command
    3030from webkitpy.tool.bot.flakytestreporter import FlakyTestReporter
    3131
     
    3434# it could be easily expanded to auto-create bugs, etc. if another
    3535# command outside of webkitpy wanted to use it.
    36 class BugForTest(AbstractDeclarativeCommand):
     36class BugForTest(Command):
    3737    name = "bug-for-test"
    3838    help_text = "Finds the bugzilla bug for a given test"
  • trunk/Tools/Scripts/webkitpy/tool/commands/bugsearch.py

    r116414 r148360  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     29from webkitpy.tool.multicommandtool import Command
    3030
    3131
    32 class BugSearch(AbstractDeclarativeCommand):
     32class BugSearch(Command):
    3333    name = "bug-search"
    3434    help_text = "List bugs matching a query"
  • trunk/Tools/Scripts/webkitpy/tool/commands/chromechannels.py

    r116414 r148360  
    3030
    3131from webkitpy.common.net.omahaproxy import OmahaProxy
    32 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     32from webkitpy.tool.multicommandtool import Command
    3333
    3434import re
    3535
    3636
    37 class ChromeChannels(AbstractDeclarativeCommand):
     37class ChromeChannels(Command):
    3838    name = "chrome-channels"
    3939    help_text = "List which chrome channels include the patches in bugs returned by QUERY."
     
    5454
    5555    def __init__(self):
    56         AbstractDeclarativeCommand.__init__(self)
     56        Command.__init__(self)
    5757        self._re_committed = re.compile(self.commited_pattern)
    5858        self._re_rollout = re.compile(self.rollout_pattern)
  • trunk/Tools/Scripts/webkitpy/tool/commands/download.py

    r140508 r148360  
    3939from webkitpy.tool.comments import bug_comment_from_commit_text
    4040from webkitpy.tool.grammar import pluralize
    41 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     41from webkitpy.tool.multicommandtool import Command
    4242
    4343_log = logging.getLogger(__name__)
     
    146146
    147147
    148 class AbstractPatchProcessingCommand(AbstractDeclarativeCommand):
     148class AbstractPatchProcessingCommand(Command):
    149149    # Subclasses must implement the methods below.  We don't declare them here
    150150    # because we want to be able to implement them with mix-ins.
  • trunk/Tools/Scripts/webkitpy/tool/commands/findusers.py

    r95238 r148360  
    2727# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2828
    29 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     29from webkitpy.tool.multicommandtool import Command
    3030
    3131
    32 class FindUsers(AbstractDeclarativeCommand):
     32class FindUsers(Command):
    3333    name = "find-users"
    3434    help_text = "Find users matching substring"
  • trunk/Tools/Scripts/webkitpy/tool/commands/openbugs.py

    r135744 r148360  
    3131import sys
    3232
    33 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     33from webkitpy.tool.multicommandtool import Command
    3434
    3535_log = logging.getLogger(__name__)
    3636
    3737
    38 class OpenBugs(AbstractDeclarativeCommand):
     38class OpenBugs(Command):
    3939    name = "open-bugs"
    4040    help_text = "Finds all bug numbers passed in arguments (or stdin if no args provided) and opens them in a web browser"
  • trunk/Tools/Scripts/webkitpy/tool/commands/queries.py

    r143033 r148360  
    4747from webkitpy.tool.commands.abstractsequencedcommand import AbstractSequencedCommand
    4848from webkitpy.tool.grammar import pluralize
    49 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     49from webkitpy.tool.multicommandtool import Command
    5050from webkitpy.layout_tests.models.test_expectations import TestExpectations
    5151from webkitpy.layout_tests.port import platform_options, configuration_options
     
    6565
    6666
    67 class BugsToCommit(AbstractDeclarativeCommand):
     67class BugsToCommit(Command):
    6868    name = "bugs-to-commit"
    6969    help_text = "List bugs in the commit-queue"
     
    7676
    7777
    78 class PatchesInCommitQueue(AbstractDeclarativeCommand):
     78class PatchesInCommitQueue(Command):
    7979    name = "patches-in-commit-queue"
    8080    help_text = "List patches in the commit-queue"
     
    8787
    8888
    89 class PatchesToCommitQueue(AbstractDeclarativeCommand):
     89class PatchesToCommitQueue(Command):
    9090    name = "patches-to-commit-queue"
    9191    help_text = "Patches which should be added to the commit queue"
     
    9494            make_option("--bugs", action="store_true", dest="bugs", help="Output bug links instead of patch links"),
    9595        ]
    96         AbstractDeclarativeCommand.__init__(self, options=options)
     96        Command.__init__(self, options=options)
    9797
    9898    @staticmethod
     
    121121
    122122
    123 class PatchesToReview(AbstractDeclarativeCommand):
     123class PatchesToReview(Command):
    124124    name = "patches-to-review"
    125125    help_text = "List bugs which have attachments pending review"
     
    134134                        help="Specifies the email on the CC field (defaults to your bugzilla login email)"),
    135135        ]
    136         AbstractDeclarativeCommand.__init__(self, options=options)
     136        Command.__init__(self, options=options)
    137137
    138138    def _print_report(self, report, cc_email, print_all):
     
    174174        self._print_report(report, cc_email, options.all)
    175175
    176 class WhatBroke(AbstractDeclarativeCommand):
     176
     177class WhatBroke(Command):
    177178    name = "what-broke"
    178179    help_text = "Print failing buildbots (%s) and what revisions broke them" % config_urls.buildbot_url
     
    220221
    221222
    222 class ResultsFor(AbstractDeclarativeCommand):
     223class ResultsFor(Command):
    223224    name = "results-for"
    224225    help_text = "Print a list of failures for the passed revision from bots on %s" % config_urls.buildbot_url
     
    242243
    243244
    244 class FailureReason(AbstractDeclarativeCommand):
     245class FailureReason(Command):
    245246    name = "failure-reason"
    246247    help_text = "Lists revisions where individual test failures started at %s" % config_urls.buildbot_url
     
    328329
    329330
    330 class FindFlakyTests(AbstractDeclarativeCommand):
     331class FindFlakyTests(Command):
    331332    name = "find-flaky-tests"
    332333    help_text = "Lists tests that often fail for a single build at %s" % config_urls.buildbot_url
     
    397398
    398399
    399 class TreeStatus(AbstractDeclarativeCommand):
     400class TreeStatus(Command):
    400401    name = "tree-status"
    401402    help_text = "Print the status of the %s buildbots" % config_urls.buildbot_url
     
    409410
    410411
    411 class CrashLog(AbstractDeclarativeCommand):
     412class CrashLog(Command):
    412413    name = "crash-log"
    413414    help_text = "Print the newest crash log for the given process"
     
    424425
    425426
    426 class PrintExpectations(AbstractDeclarativeCommand):
     427class PrintExpectations(Command):
    427428    name = 'print-expectations'
    428429    help_text = 'Print the expected result for the given test(s) on the given port(s)'
     
    444445        ] + platform_options(use_globs=True)
    445446
    446         AbstractDeclarativeCommand.__init__(self, options=options)
     447        Command.__init__(self, options=options)
    447448        self._expectation_models = {}
    448449
     
    515516
    516517
    517 class PrintBaselines(AbstractDeclarativeCommand):
     518class PrintBaselines(Command):
    518519    name = 'print-baselines'
    519520    help_text = 'Prints the baseline locations for given test(s) on the given port(s)'
     
    528529                        help='Include virtual tests'),
    529530        ] + platform_options(use_globs=True)
    530         AbstractDeclarativeCommand.__init__(self, options=options)
     531        Command.__init__(self, options=options)
    531532        self._platform_regexp = re.compile('platform/([^\/]+)/(.+)')
    532533
  • trunk/Tools/Scripts/webkitpy/tool/commands/queues.py

    r148352 r148360  
    7373            make_option("--exit-after-iteration", action="store", type="int", dest="iterations", default=None, help="Stop running the queue after iterating this number of times."),
    7474        ]
    75         Command.__init__(self, "Run the %s" % self.name, options=options_list)
     75        self.help_text = "Run the %s" % self.name
     76        Command.__init__(self, options=options_list)
    7677        self._iteration_count = 0
    7778
  • trunk/Tools/Scripts/webkitpy/tool/commands/rebaseline.py

    r148352 r148360  
    3939from webkitpy.layout_tests.port import builders
    4040from webkitpy.layout_tests.port import factory
    41 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     41from webkitpy.tool.multicommandtool import Command
    4242
    4343
     
    5050
    5151
    52 class AbstractRebaseliningCommand(AbstractDeclarativeCommand):
     52class AbstractRebaseliningCommand(Command):
    5353    # not overriding execute() - pylint: disable=W0223
    5454
  • trunk/Tools/Scripts/webkitpy/tool/commands/suggestnominations.py

    r97891 r148360  
    3535from webkitpy.tool import steps
    3636from webkitpy.tool.grammar import join_with_separators
    37 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
    38 
    39 
    40 class SuggestNominations(AbstractDeclarativeCommand):
     37from webkitpy.tool.multicommandtool import Command
     38
     39
     40class SuggestNominations(Command):
    4141    name = "suggest-nominations"
    4242    help_text = "Suggest contributors for committer/reviewer nominations"
     
    5050        ]
    5151
    52         AbstractDeclarativeCommand.__init__(self, options=options)
     52        Command.__init__(self, options=options)
    5353        # FIXME: This should probably be on the tool somewhere.
    5454        self._committer_list = CommitterList()
  • trunk/Tools/Scripts/webkitpy/tool/commands/upload.py

    r140674 r148360  
    4444from webkitpy.tool.comments import bug_comment_from_svn_revision
    4545from webkitpy.tool.grammar import pluralize, join_with_separators
    46 from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
     46from webkitpy.tool.multicommandtool import Command
    4747
    4848_log = logging.getLogger(__name__)
    4949
    5050
    51 class CommitMessageForCurrentDiff(AbstractDeclarativeCommand):
     51class CommitMessageForCurrentDiff(Command):
    5252    name = "commit-message"
    5353    help_text = "Print a commit message suitable for the uncommitted changes"
     
    5757            steps.Options.git_commit,
    5858        ]
    59         AbstractDeclarativeCommand.__init__(self, options=options)
     59        Command.__init__(self, options=options)
    6060
    6161    def execute(self, options, args, tool):
     
    6565
    6666
    67 class CleanPendingCommit(AbstractDeclarativeCommand):
     67class CleanPendingCommit(Command):
    6868    name = "clean-pending-commit"
    6969    help_text = "Clear r+ on obsolete patches so they do not appear in the pending-commit list."
     
    9595
    9696# FIXME: This should be share more logic with AssignToCommitter and CleanPendingCommit
    97 class CleanReviewQueue(AbstractDeclarativeCommand):
     97class CleanReviewQueue(Command):
    9898    name = "clean-review-queue"
    9999    help_text = "Clear r? on obsolete patches so they do not appear in the pending-review list."
     
    120120
    121121
    122 class AssignToCommitter(AbstractDeclarativeCommand):
     122class AssignToCommitter(Command):
    123123    name = "assign-to-committer"
    124124    help_text = "Assign bug to whoever attached the most recent r+'d patch"
     
    307307
    308308
    309 class PostCommits(AbstractDeclarativeCommand):
     309class PostCommits(Command):
    310310    name = "post-commits"
    311311    help_text = "Attach a range of local commits to bugs as patch files"
     
    321321            steps.Options.request_commit,
    322322        ]
    323         AbstractDeclarativeCommand.__init__(self, options=options, requires_local_commits=True)
     323        Command.__init__(self, options=options, requires_local_commits=True)
    324324
    325325    def _comment_text_for_commit(self, options, commit_message, tool, commit_id):
     
    359359
    360360# FIXME: This command needs to be brought into the modern age with steps and CommitInfo.
    361 class MarkBugFixed(AbstractDeclarativeCommand):
     361class MarkBugFixed(Command):
    362362    name = "mark-bug-fixed"
    363363    help_text = "Mark the specified bug as fixed"
     
    370370            make_option("--update-only", action="store_true", default=False, dest="update_only", help="Add comment to the bug, but do not close it."),
    371371        ]
    372         AbstractDeclarativeCommand.__init__(self, options=options)
     372        Command.__init__(self, options=options)
    373373
    374374    # FIXME: We should be using checkout().changelog_entries_for_revision(...) instead here.
     
    440440
    441441# FIXME: Requires unit test.  Blocking issue: too complex for now.
    442 class CreateBug(AbstractDeclarativeCommand):
     442class CreateBug(Command):
    443443    name = "create-bug"
    444444    help_text = "Create a bug from local changes or local commits"
     
    453453            make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review."),
    454454        ]
    455         AbstractDeclarativeCommand.__init__(self, options=options)
     455        Command.__init__(self, options=options)
    456456
    457457    def create_bug_from_commit(self, options, args, tool):
  • trunk/Tools/Scripts/webkitpy/tool/multicommandtool.py

    r135744 r148360  
    4949    name = None
    5050    show_in_main_help = False
    51     def __init__(self, help_text, argument_names=None, options=None, long_help=None, requires_local_commits=False):
    52         self.help_text = help_text
    53         self.long_help = long_help
    54         self.argument_names = argument_names
    55         self.required_arguments = self._parse_required_arguments(argument_names)
     51    help_text = None
     52    long_help = None
     53    argument_names = None
     54
     55    def __init__(self, options=None, requires_local_commits=False):
     56        self.required_arguments = self._parse_required_arguments(self.argument_names)
    5657        self.options = options
    5758        self.requires_local_commits = requires_local_commits
     
    140141
    141142
    142 # FIXME: This should just be rolled into Command.  help_text and argument_names do not need to be instance variables.
    143 class AbstractDeclarativeCommand(Command):
    144     help_text = None
    145     argument_names = None
    146     long_help = None
    147     def __init__(self, options=None, **kwargs):
    148         Command.__init__(self, self.help_text, self.argument_names, options=options, long_help=self.long_help, **kwargs)
    149 
    150 
    151143class HelpPrintingOptionParser(OptionParser):
    152144    def __init__(self, epilog_method=None, *args, **kwargs):
     
    169161
    170162
    171 class HelpCommand(AbstractDeclarativeCommand):
     163class HelpCommand(Command):
    172164    name = "help"
    173165    help_text = "Display information about this program or its subcommands"
     
    178170            make_option("-a", "--all-commands", action="store_true", dest="show_all_commands", help="Print all available commands"),
    179171        ]
    180         AbstractDeclarativeCommand.__init__(self, options)
     172        Command.__init__(self, options)
    181173        self.show_all_commands = False # A hack used to pass --all-commands to _help_epilog even though it's called by the OptionParser.
    182174
  • trunk/Tools/Scripts/webkitpy/tool/multicommandtool_unittest.py

    r140510 r148360  
    3939    name = "trivial"
    4040    show_in_main_help = True
     41    help_text = "help text"
    4142    def __init__(self, **kwargs):
    42         Command.__init__(self, "help text", **kwargs)
     43        Command.__init__(self, **kwargs)
    4344
    4445    def execute(self, options, args, tool):
     
    5455    name = "likes-to-retry"
    5556    show_in_main_help = True
     57    help_text = "help text"
    5658
    5759    def __init__(self, **kwargs):
    58         Command.__init__(self, "help text", **kwargs)
     60        Command.__init__(self, **kwargs)
    5961        self.execute_count = 0
    6062
     
    6769class CommandTest(unittest.TestCase):
    6870    def test_name_with_arguments(self):
    69         command_with_args = TrivialCommand(argument_names="ARG1 ARG2")
     71        TrivialCommand.argument_names = "ARG1 ARG2"
     72        command_with_args = TrivialCommand()
    7073        self.assertEqual(command_with_args.name_with_arguments(), "trivial ARG1 ARG2")
    7174
     75        TrivialCommand.argument_names = None
    7276        command_with_args = TrivialCommand(options=[make_option("--my_option")])
    7377        self.assertEqual(command_with_args.name_with_arguments(), "trivial [options]")
     
    8185
    8286    def test_required_arguments(self):
    83         two_required_arguments = TrivialCommand(argument_names="ARG1 ARG2 [ARG3]")
     87        TrivialCommand.argument_names = "ARG1 ARG2 [ARG3]"
     88        two_required_arguments = TrivialCommand()
    8489        expected_logs = "2 arguments required, 1 argument provided.  Provided: 'foo'  Required: ARG1 ARG2\nSee 'trivial-tool help trivial' for usage.\n"
    8590        exit_code = OutputCapture().assert_outputs(self, two_required_arguments.check_arguments_and_execute, [None, ["foo"], TrivialTool()], expected_logs=expected_logs)
     
    168173
    169174    def test_command_help(self):
    170         command_with_options = TrivialCommand(options=[make_option("--my_option")], long_help="LONG HELP")
     175        command_with_options = TrivialCommand(options=[make_option("--my_option")])
     176        command_with_options.long_help = "LONG HELP"
    171177        tool = TrivialTool(commands=[command_with_options])
    172178        expected_subcommand_help = "trivial [options]   help text\n\nLONG HELP\n\nOptions:\n  --my_option=MY_OPTION\n\n"
Note: See TracChangeset for help on using the changeset viewer.