Changeset 52707 in webkit


Ignore:
Timestamp:
Jan 4, 2010 12:13:19 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-04 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Make all commands AbstractDeclarativeCommmands instead of direct Command subclasses
https://bugs.webkit.org/show_bug.cgi?id=33131

Evenetually we'll probably roll AbstractDeclarativeCommmand directly into Command
but for now we just deploy it everywhere and don't try to fix up the few valid uses
of Command.

  • Scripts/webkitpy/commands/download.py:
  • Scripts/webkitpy/commands/queries.py:
  • Scripts/webkitpy/commands/upload.py:
  • Scripts/webkitpy/multicommandtool.py:
Location:
trunk/WebKitTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r52705 r52707  
     12010-01-04  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Make all commands AbstractDeclarativeCommmands instead of direct Command subclasses
     6        https://bugs.webkit.org/show_bug.cgi?id=33131
     7
     8        Evenetually we'll probably roll AbstractDeclarativeCommmand directly into Command
     9        but for now we just deploy it everywhere and don't try to fix up the few valid uses
     10        of Command.
     11
     12        * Scripts/webkitpy/commands/download.py:
     13        * Scripts/webkitpy/commands/queries.py:
     14        * Scripts/webkitpy/commands/upload.py:
     15        * Scripts/webkitpy/multicommandtool.py:
     16
    1172010-01-03  Adam Barth  <abarth@webkit.org>
    218
  • trunk/WebKitTools/Scripts/webkitpy/commands/download.py

    r52703 r52707  
    4141from webkitpy.grammar import pluralize
    4242from webkitpy.webkit_logging import error, log
    43 from webkitpy.multicommandtool import AbstractDeclarativeCommmand, Command
     43from webkitpy.multicommandtool import AbstractDeclarativeCommmand
    4444from webkitpy.stepsequence import StepSequence
    4545
     
    246246
    247247# FIXME: Make Rollout more declarative.
    248 class Rollout(Command):
     248class Rollout(AbstractDeclarativeCommmand):
    249249    name = "rollout"
    250250    show_in_main_help = True
     251    help_text = "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug"
     252    argument_names = "REVISION [BUGID]"
    251253    def __init__(self):
    252254        self._sequence = StepSequence([
     
    257259            CompleteRollout,
    258260        ])
    259         Command.__init__(self, "Revert the given revision in the working copy and optionally commit the revert and re-open the original bug", "REVISION [BUGID]", options=self._sequence.options())
     261        AbstractDeclarativeCommmand.__init__(self, self._sequence.options())
    260262
    261263    @staticmethod
  • trunk/WebKitTools/Scripts/webkitpy/commands/queries.py

    r52703 r52707  
    3535from webkitpy.committers import CommitterList
    3636from webkitpy.webkit_logging import log
    37 from webkitpy.multicommandtool import Command
     37from webkitpy.multicommandtool import AbstractDeclarativeCommmand
    3838
    3939
    40 class BugsToCommit(Command):
     40class BugsToCommit(AbstractDeclarativeCommmand):
    4141    name = "bugs-to-commit"
    42     def __init__(self):
    43         Command.__init__(self, "List bugs in the commit-queue")
     42    help_text = "List bugs in the commit-queue"
    4443
    4544    def execute(self, options, args, tool):
     
    4948
    5049
    51 class PatchesToCommit(Command):
     50class PatchesToCommit(AbstractDeclarativeCommmand):
    5251    name = "patches-to-commit"
    53     def __init__(self):
    54         Command.__init__(self, "List patches in the commit-queue")
     52    help_text = "List patches in the commit-queue"
    5553
    5654    def execute(self, options, args, tool):
     
    6159
    6260
    63 class PatchesToCommitQueue(Command):
     61class PatchesToCommitQueue(AbstractDeclarativeCommmand):
    6462    name = "patches-to-commit-queue"
     63    help_text = "Patches which should be added to the commit queue"
    6564    def __init__(self):
    6665        options = [
    6766            make_option("--bugs", action="store_true", dest="bugs", help="Output bug links instead of patch links"),
    6867        ]
    69         Command.__init__(self, "Patches which should be added to the commit queue", options=options)
     68        AbstractDeclarativeCommmand.__init__(self, options=options)
    7069
    7170    @staticmethod
     
    9594
    9695
    97 class PatchesToReview(Command):
     96class PatchesToReview(AbstractDeclarativeCommmand):
    9897    name = "patches-to-review"
    99     def __init__(self):
    100         Command.__init__(self, "List patches that are pending review")
     98    help_text = "List patches that are pending review"
    10199
    102100    def execute(self, options, args, tool):
     
    107105
    108106
    109 class ReviewedPatches(Command):
     107class ReviewedPatches(AbstractDeclarativeCommmand):
    110108    name = "reviewed-patches"
    111     def __init__(self):
    112         Command.__init__(self, "List r+'d patches on a bug", "BUGID")
     109    help_text = "List r+'d patches on a bug"
     110    argument_names = "BUGID"
    113111
    114112    def execute(self, options, args, tool):
     
    119117
    120118
    121 class TreeStatus(Command):
     119class TreeStatus(AbstractDeclarativeCommmand):
    122120    name = "tree-status"
    123121    show_in_main_help = True
    124     def __init__(self):
    125         Command.__init__(self, "Print the status of the %s buildbots" % BuildBot.default_host)
     122    help_text = "Print the status of the %s buildbots" % BuildBot.default_host
    126123
    127124    def execute(self, options, args, tool):
  • trunk/WebKitTools/Scripts/webkitpy/commands/upload.py

    r52704 r52707  
    4343from webkitpy.grammar import pluralize
    4444from webkitpy.webkit_logging import error, log
    45 from webkitpy.multicommandtool import Command, AbstractDeclarativeCommmand
     45from webkitpy.multicommandtool import AbstractDeclarativeCommmand
    4646
    4747# FIXME: Requires unit test.
    48 class CommitMessageForCurrentDiff(Command):
     48class CommitMessageForCurrentDiff(AbstractDeclarativeCommmand):
    4949    name = "commit-message"
    50     def __init__(self):
    51         Command.__init__(self, "Print a commit message suitable for the uncommitted changes")
     50    help_text = "Print a commit message suitable for the uncommitted changes"
    5251
    5352    def execute(self, options, args, tool):
     
    172171
    173172
    174 class PostCommits(Command):
     173class PostCommits(AbstractDeclarativeCommmand):
    175174    name = "post-commits"
    176175    show_in_main_help = True
     176    help_text = "Attach a range of local commits to bugs as patch files"
     177    argument_names = "COMMITISH"
     178   
    177179    def __init__(self):
    178180        options = [
     
    184186            CommandOptions.request_commit,
    185187        ]
    186         Command.__init__(self, "Attach a range of local commits to bugs as patch files", "COMMITISH", options=options, requires_local_commits=True)
     188        AbstractDeclarativeCommmand.__init__(self, options=options, requires_local_commits=True)
    187189
    188190    def _comment_text_for_commit(self, options, commit_message, tool, commit_id):
     
    225227
    226228# FIXME: Requires unit test.  Blocking issue: too complex for now.
    227 class MarkBugFixed(Command):
     229class MarkBugFixed(AbstractDeclarativeCommmand):
    228230    name = "mark-bug-fixed"
    229231    show_in_main_help = True
     232    help_text = "Mark the specified bug as fixed"
     233    argument_names = "[SVN_REVISION]"
    230234    def __init__(self):
    231235        options = [
     
    235239            make_option("--update-only", action="store_true", default=False, dest="update_only", help="Add comment to the bug, but do not close it."),
    236240        ]
    237         Command.__init__(self, "Mark the specified bug as fixed", "[SVN_REVISION]", options=options)
     241        AbstractDeclarativeCommmand.__init__(self, options=options)
    238242
    239243    def _fetch_commit_log(self, tool, svn_revision):
     
    312316
    313317# FIXME: Requires unit test.  Blocking issue: too complex for now.
    314 class CreateBug(Command):
     318class CreateBug(AbstractDeclarativeCommmand):
    315319    name = "create-bug"
    316320    show_in_main_help = True
     321    help_text = "Create a bug from local changes or local commits"
     322    argument_names = "[COMMITISH]"
     323
    317324    def __init__(self):
    318325        options = [
     
    323330            make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review."),
    324331        ]
    325         Command.__init__(self, "Create a bug from local changes or local commits", "[COMMITISH]", options=options)
     332        AbstractDeclarativeCommmand.__init__(self, options=options)
    326333
    327334    def create_bug_from_commit(self, options, args, tool):
  • trunk/WebKitTools/Scripts/webkitpy/multicommandtool.py

    r52703 r52707  
    132132    help_text = None
    133133    argument_names = None
    134     def __init__(self, options=None):
    135         Command.__init__(self, self.help_text, self.argument_names, options)
     134    def __init__(self, options=None, **kwargs):
     135        Command.__init__(self, self.help_text, self.argument_names, options=options, **kwargs)
    136136
    137137
     
    156156
    157157
    158 class HelpCommand(Command):
     158class HelpCommand(AbstractDeclarativeCommmand):
    159159    name = "help"
     160    help_text = "Display information about this program or its subcommands"
     161    argument_names = "[COMMAND]"
    160162
    161163    def __init__(self):
     
    163165            make_option("-a", "--all-commands", action="store_true", dest="show_all_commands", help="Print all available commands"),
    164166        ]
    165         Command.__init__(self, "Display information about this program or its subcommands", "[COMMAND]", options=options)
     167        AbstractDeclarativeCommmand.__init__(self, options)
    166168        self.show_all_commands = False # A hack used to pass --all-commands to _help_epilog even though it's called by the OptionParser.
    167169
Note: See TracChangeset for help on using the changeset viewer.