Changeset 51232 in webkit


Ignore:
Timestamp:
Nov 19, 2009 11:01:26 PM (14 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Eric Seidel.

Abstract AbstractPatchProcessingCommand from AbstractPatchLandingCommand
https://bugs.webkit.org/show_bug.cgi?id=31707

This is to help when we implement build-attachment.

  • Scripts/bugzilla-tool:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51231 r51232  
     12009-11-19  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Abstract AbstractPatchProcessingCommand from AbstractPatchLandingCommand
     6        https://bugs.webkit.org/show_bug.cgi?id=31707
     7
     8        This is to help when we implement build-attachment.
     9
     10        * Scripts/bugzilla-tool:
     11
    1122009-11-19  Adam Barth  <abarth@webkit.org>
    213
  • trunk/WebKitTools/Scripts/bugzilla-tool

    r51231 r51232  
    387387
    388388
    389 class AbstractPatchLandingCommand(Command):
    390     def __init__(self, description, args_description):
    391         options = WebKitLandingScripts.cleaning_options() + WebKitLandingScripts.land_options()
     389class AbstractPatchProcessingCommand(Command):
     390    def __init__(self, description, args_description, options):
    392391        Command.__init__(self, description, args_description, options=options)
    393392
    394     @staticmethod
    395     def _fetch_list_of_patches_to_land(options, args, tool):
     393    def _fetch_list_of_patches_to_process(self, options, args, tool):
     394        raise NotImplementedError, "subclasses must implement"
     395
     396    def _prepare_to_process(self, options, args, tool):
    396397        raise NotImplementedError, "subclasses must implement"
    397398
     
    408409            error("%s required" % self.argument_names)
    409410
     411        self._prepare_to_process(options, args, tool)
     412        patches = self._fetch_list_of_patches_to_process(options, args, tool)
     413
     414        # It's nice to print out total statistics.
     415        bugs_to_patches = self._collect_patches_by_bug(patches)
     416        log("Processing %s from %s." % (pluralize("patch", len(patches)), pluralize("bug", len(bugs_to_patches))))
     417
     418        for patch in patches:
     419            self._process_patch(patch, options, args, tool)
     420
     421
     422class AbstractPatchLandingCommand(AbstractPatchProcessingCommand):
     423    def __init__(self, description, args_description):
     424        options = WebKitLandingScripts.cleaning_options() + WebKitLandingScripts.land_options()
     425        AbstractPatchProcessingCommand.__init__(self, description, args_description, options)
     426
     427    def _prepare_to_process(self, options, args, tool):
    410428        # Check the tree status first so we can fail early.
    411429        WebKitLandingScripts.ensure_builders_are_green(tool.buildbot, options)
    412430        WebKitLandingScripts.prepare_clean_working_directory(tool.scm(), options)
    413431
    414         patches = self._fetch_list_of_patches_to_land(options, args, tool)
    415 
    416         # It's nice to print out total statistics.
    417         bugs_to_patches = self._collect_patches_by_bug(patches)
    418         log("Landing %s from %s." % (pluralize("patch", len(patches)), pluralize("bug", len(bugs_to_patches))))
    419 
    420         for patch in patches:
    421             WebKitLandingScripts.land_patch_and_handle_errors(patch, options, tool)
     432    def _process_patch(self, patch, options, args, tool):
     433        WebKitLandingScripts.land_patch_and_handle_errors(patch, options, tool)
    422434
    423435
     
    426438        AbstractPatchLandingCommand.__init__(self, "Lands a patches from bugzilla, optionally building and testing them first", "ATTACHMENT_ID [ATTACHMENT_IDS]")
    427439
    428     @staticmethod
    429     def _fetch_list_of_patches_to_land(options, args, tool):
     440    def _fetch_list_of_patches_to_process(self, options, args, tool):
    430441        return map(lambda patch_id: tool.bugs.fetch_attachment(patch_id), args)
    431442
     
    435446        AbstractPatchLandingCommand.__init__(self, "Lands all patches on the given bugs, optionally building and testing them first", "BUGID [BUGIDS]")
    436447
    437     @staticmethod
    438     def _fetch_list_of_patches_to_land(options, args, tool):
     448    def _fetch_list_of_patches_to_process(self, options, args, tool):
    439449        all_patches = []
    440450        for bug_id in args:
Note: See TracChangeset for help on using the changeset viewer.