Changeset 51447 in webkit


Ignore:
Timestamp:
Nov 27, 2009 3:34:44 PM (14 years ago)
Author:
abarth@webkit.org
Message:

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

Reviewed by Eric Seidel.

style-queue should only process each patch once
https://bugs.webkit.org/show_bug.cgi?id=31939

Before processing a patch, the try-queues now ask the web service
whether they have already processed the patch. This is an initial cut
of this functionality. I expect we're make it richer over time.

  • Scripts/bugzilla-tool:
  • Scripts/modules/commands/queues.py:
  • Scripts/modules/patchcollection.py:
Location:
trunk/WebKitTools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51446 r51447  
     12009-11-27  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        style-queue should only process each patch once
     6        https://bugs.webkit.org/show_bug.cgi?id=31939
     7
     8        Before processing a patch, the try-queues now ask the web service
     9        whether they have already processed the patch.  This is an initial cut
     10        of this functionality.  I expect we're make it richer over time.
     11
     12        * Scripts/bugzilla-tool:
     13        * Scripts/modules/commands/queues.py:
     14        * Scripts/modules/patchcollection.py:
     15
    1162009-11-27  Adam Barth  <abarth@webkit.org>
    217
  • trunk/WebKitTools/Scripts/bugzilla-tool

    r51431 r51447  
    4747        self.bugs = Bugzilla()
    4848        self.buildbot = BuildBot()
    49         self.cached_scm = None
     49        self._cached_scm = None
     50        self._cached_status = None
    5051        self.steps = BuildSteps()
    5152
     
    5758        # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
    5859        original_cwd = os.path.abspath(".")
    59         if not self.cached_scm:
    60             self.cached_scm = detect_scm_system(original_cwd)
     60        if not self._cached_scm:
     61            self._cached_scm = detect_scm_system(original_cwd)
    6162
    62         if not self.cached_scm:
     63        if not self._cached_scm:
    6364            script_directory = os.path.abspath(sys.path[0])
    6465            webkit_directory = os.path.abspath(os.path.join(script_directory, "../.."))
    65             self.cached_scm = detect_scm_system(webkit_directory)
    66             if self.cached_scm:
     66            self._cached_scm = detect_scm_system(webkit_directory)
     67            if self._cached_scm:
    6768                log("The current directory (%s) is not a WebKit checkout, using %s" % (original_cwd, webkit_directory))
    6869            else:
    6970                error("FATAL: Failed to determine the SCM system for either %s or %s" % (original_cwd, webkit_directory))
    7071
    71         return self.cached_scm
     72        return self._cached_scm
     73
     74    def status(self):
     75        if not self._cached_status:
     76            self._cached_status = StatusBot()
     77        return self._cached_status
    7278
    7379    def path(self):
  • trunk/WebKitTools/Scripts/modules/bugzilla.py

    r51277 r51447  
    325325        return patches_to_land
    326326
    327     def fetch_patches_from_review_queue(self, limit):
     327    def fetch_patches_from_review_queue(self, limit=None):
    328328        patches_to_review = []
    329329        for bug_id in self.fetch_bug_ids_from_review_queue():
    330             if len(patches_to_review) >= limit:
     330            if limit and len(patches_to_review) >= limit:
    331331                break
    332332            patches = self.fetch_unreviewed_patches_from_bug(bug_id)
  • trunk/WebKitTools/Scripts/modules/commands/queues.py

    r51435 r51447  
    4848from modules.logging import error, log, tee
    4949from modules.multicommandtool import MultiCommandTool, Command
    50 from modules.patchcollection import PatchCollection
     50from modules.patchcollection import PatchCollection, PersistentPatchCollection, PersistentPatchCollectionDelegate
    5151from modules.processutils import run_and_throw_if_fail
    5252from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate
     
    140140
    141141
    142 class AbstractTryQueue(AbstractQueue):
     142class AbstractTryQueue(AbstractQueue, PersistentPatchCollectionDelegate):
    143143    def __init__(self, options=[]):
    144144        AbstractQueue.__init__(self, options)
    145145
     146    # PersistentPatchCollectionDelegate methods
     147
     148    def collection_name(self):
     149        return self.name
     150
     151    def fetch_potential_patches(self):
     152        return self.tool.bugs.fetch_patches_from_review_queue(limit=3)
     153
     154    def status_server(self):
     155        return self.tool.status()
     156
     157    # AbstractQueue methods
     158
    146159    def status_host(self):
    147160        return None # FIXME: A hack until we come up with a more generic status page.
     
    149162    def begin_work_queue(self):
    150163        AbstractQueue.begin_work_queue(self)
    151         self._patches = PatchCollection(self.tool.bugs)
    152         self._patches.add_patches(self.tool.bugs.fetch_patches_from_review_queue(limit=10))
     164        self._patches = PersistentPatchCollection(self)
    153165
    154166    def next_work_item(self):
    155         self.log_progress(self._patches.patch_ids())
    156167        return self._patches.next()
    157168
     
    164175    def handle_unexpected_error(self, patch, message):
    165176        log(message)
     177        self._patches.done(patch)
    166178
    167179
     
    177189    def process_work_item(self, patch):
    178190        self.run_bugzilla_tool(["check-style", "--force-clean", patch["id"]])
     191        self._patches.done(patch)
    179192
    180193
     
    199212    def process_work_item(self, patch):
    200213        self.run_bugzilla_tool(["build-attachment", self.port.flag(), "--force-clean", "--quiet", "--no-update", patch["id"]])
     214        self._patches.done(patch)
  • trunk/WebKitTools/Scripts/modules/patchcollection.py

    r51030 r51447  
    5858    def __len__(self):
    5959        return len(self._patches)
     60
     61
     62class PersistentPatchCollectionDelegate:
     63    def collection_name(self):
     64        raise NotImplementedError, "subclasses must implement"
     65
     66    def fetch_potential_patches(self):
     67        raise NotImplementedError, "subclasses must implement"
     68
     69    def status_server(self):
     70        raise NotImplementedError, "subclasses must implement"
     71
     72
     73class PersistentPatchCollection:
     74    _initial_status = "Attempted"
     75    _terminal_status = "Done"
     76    def __init__(self, delegate):
     77        self._delegate = delegate
     78        self._name = self._delegate.collection_name()
     79        self._status = self._delegate.status_server()
     80
     81    def next(self):
     82        patches = self._delegate.fetch_potential_patches()
     83        for patch in patches:
     84            last_status = self._status.patch_status(self._name, patch["id"])
     85            if not last_status: # FIXME: Add support for "Try again"
     86                self._status.update_status(self._name, self._initial_status, patch)
     87                return patch
     88
     89    def done(self, patch):
     90        self._status.update_status(self._name, self._terminal_status, patch)
Note: See TracChangeset for help on using the changeset viewer.