Changeset 51281 in webkit


Ignore:
Timestamp:
Nov 21, 2009 7:29:00 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-11-21 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Convert check-style to use LandingSequence
https://bugs.webkit.org/show_bug.cgi?id=31763

Instead of manipulating the working copy by hand, we should use the
LandingSequence in CheckStyle. This will make this code eaiser to
test.

  • Scripts/modules/commands/download.py:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51278 r51281  
     12009-11-21  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Convert check-style to use LandingSequence
     6        https://bugs.webkit.org/show_bug.cgi?id=31763
     7
     8        Instead of manipulating the working copy by hand, we should use the
     9        LandingSequence in CheckStyle.  This will make this code eaiser to
     10        test.
     11
     12        * Scripts/modules/commands/download.py:
     13
    1142009-11-20  Adam Barth  <abarth@webkit.org>
    215
  • trunk/WebKitTools/Scripts/modules/commands/download.py

    r51263 r51281  
    5555from modules.workqueue import WorkQueue, WorkQueueDelegate
    5656
    57 class CheckStyle(Command):
    58     name = "check-style"
    59     def __init__(self):
    60         options = WebKitLandingScripts.cleaning_options()
    61         Command.__init__(self, "Runs check-webkit-style on the specified attachment", "ATTACHMENT_ID", options=options)
    62 
    63     @classmethod
    64     def check_style(cls, patch, options, tool):
    65         tool.scm().update_webkit()
    66         log("Checking style for patch %s from bug %s." % (patch["id"], patch["bug_id"]))
    67         try:
    68             # FIXME: check-webkit-style shouldn't really have to apply the patch to check the style.
    69             tool.scm().apply_patch(patch)
    70             WebKitLandingScripts.run_webkit_script("check-webkit-style")
    71         except ScriptError, e:
    72             log("Patch %s from bug %s failed to apply and check style." % (patch["id"], patch["bug_id"]))
    73             log(e.output)
    74 
    75         # This is safe because in order to get here the working directory had to be
    76         # clean at the beginning.  Clean it out again before we exit.
    77         tool.scm().ensure_clean_working_directory(force_clean=True)
    78 
    79     def execute(self, options, args, tool):
    80         attachment_id = args[0]
    81         attachment = tool.bugs.fetch_attachment(attachment_id)
    82 
    83         WebKitLandingScripts.prepare_clean_working_directory(tool.scm(), options)
    84         self.check_style(attachment, options, tool)
    85 
    8657
    8758class BuildSequence(ConditionalLandingSequence):
     
    271242
    272243
     244class CheckStyleSequence(LandingSequence):
     245    def __init__(self, patch, options, tool):
     246        ConditionalLandingSequence.__init__(self, patch, options, tool)
     247
     248    def run(self):
     249        self.clean()
     250        self.update()
     251        self.apply_patch()
     252        self.build()
     253
     254    def build(self):
     255        # Instead of building, we check style.
     256        WebKitLandingScripts.run_webkit_script("check-webkit-style")
     257
     258
     259class CheckStyle(AbstractPatchProcessingCommand):
     260    name = "check-style"
     261    def __init__(self):
     262        options = WebKitLandingScripts.cleaning_options()
     263        AbstractPatchProcessingCommand.__init__(self, "Runs check-webkit-style on the specified attachments.", "ATTACHMENT_ID [ATTACHMENT_IDS]", options)
     264
     265    def _fetch_list_of_patches_to_process(self, options, args, tool):
     266        return map(lambda patch_id: tool.bugs.fetch_attachment(patch_id), args)
     267
     268    def _prepare_to_process(self, options, args, tool):
     269        pass
     270
     271    def _process_patch(self, patch, options, args, tool):
     272        sequence = CheckStyleSequence(patch, options, tool)
     273        sequence.run_and_handle_errors()
     274
     275
    273276class BuildAttachmentSequence(LandingSequence):
    274277    def __init__(self, patch, options, tool):
Note: See TracChangeset for help on using the changeset viewer.