class CommitQueue(AbstractQueue, StepSequenceErrorHandler): name = "commit-queue" def __init__(self): AbstractQueue.__init__(self) # AbstractQueue methods def begin_work_queue(self): AbstractQueue.begin_work_queue(self) self.committer_validator = CommitterValidator(self.tool.bugs) def _validate_patches_in_commit_queue(self): # Not using BugzillaQueries.fetch_patches_from_commit_queue() so we can reject patches with invalid committers/reviewers. bug_ids = self.tool.bugs.queries.fetch_bug_ids_from_commit_queue() all_patches = sum([self.tool.bugs.fetch_bug(bug_id).commit_queued_patches(include_invalid=True) for bug_id in bug_ids], []) return self.committer_validator.patches_after_rejecting_invalid_commiters_and_reviewers(all_patches) def next_work_item(self): patches = self._validate_patches_in_commit_queue() # FIXME: We could sort the patches in a specific order here, was suggested by https://bugs.webkit.org/show_bug.cgi?id=33395 if not patches: self._update_status("Empty queue") return None # Only bother logging if we have patches in the queue. self.log_progress([patch.id() for patch in patches]) return patches[0] def _can_build_and_test(self): try: self.run_webkit_patch(["build-and-test", "--force-clean", "--non-interactive", "--build-style=both", "--quiet"]) except ScriptError, e: self._update_status("Unabled to successfully build and test", None) return False return True