Example #1
0
    def _assign_bug_to_last_patch_attacher(self, bug_id):
        committers = CommitterList()
        bug = self.tool.bugs.fetch_bug(bug_id)
        assigned_to_email = bug.assigned_to_email()
        if assigned_to_email != self.tool.bugs.unassigned_email:
            log("Bug %s is already assigned to %s (%s)." %
                (bug_id, assigned_to_email,
                 committers.committer_by_email(assigned_to_email)))
            return

        reviewed_patches = bug.reviewed_patches()
        if not reviewed_patches:
            log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
            return

        # We only need to do anything with this bug if one of the r+'d patches does not have a valid committer (cq+ set).
        if self._patches_have_commiters(reviewed_patches):
            log("All reviewed patches on bug %s already have commit-queue+, ignoring."
                % bug_id)
            return

        latest_patch = reviewed_patches[-1]
        attacher_email = latest_patch.attacher_email()
        committer = committers.committer_by_email(attacher_email)
        if not committer:
            log("Attacher %s is not a committer.  Bug %s likely needs commit-queue+."
                % (attacher_email, bug_id))
            return

        reassign_message = "Attachment %s was posted by a committer and has review+, assigning to %s for commit." % (
            latest_patch.id(), committer.full_name)
        self.tool.bugs.reassign_bug(bug_id, committer.bugzilla_email(),
                                    reassign_message)
Example #2
0
    def _assign_bug_to_last_patch_attacher(self, bug_id):
        committers = CommitterList()
        bug = self.tool.bugs.fetch_bug(bug_id)
        assigned_to_email = bug.assigned_to_email()
        if assigned_to_email != self.tool.bugs.unassigned_email:
            log("Bug %s is already assigned to %s (%s)." % (bug_id, assigned_to_email, committers.committer_by_email(assigned_to_email)))
            return

        reviewed_patches = bug.reviewed_patches()
        if not reviewed_patches:
            log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
            return

        # We only need to do anything with this bug if one of the r+'d patches does not have a valid committer (cq+ set).
        if self._patches_have_commiters(reviewed_patches):
            log("All reviewed patches on bug %s already have commit-queue+, ignoring." % bug_id)
            return

        latest_patch = reviewed_patches[-1]
        attacher_email = latest_patch.attacher_email()
        committer = committers.committer_by_email(attacher_email)
        if not committer:
            log("Attacher %s is not a committer.  Bug %s likely needs commit-queue+." % (attacher_email, bug_id))
            return

        reassign_message = "Attachment %s was posted by a committer and has review+, assigning to %s for commit." % (latest_patch.id(), committer.full_name)
        self.tool.bugs.reassign_bug(bug_id, committer.bugzilla_email(), reassign_message)
Example #3
0
    def _needs_commit_queue(patch):
        if patch.commit_queue() == "+": # If it's already cq+, ignore the patch.
            log("%s already has cq=%s" % (patch.id(), patch.commit_queue()))
            return False

        # We only need to worry about patches from contributers who are not yet committers.
        committer_record = CommitterList().committer_by_email(patch.attacher_email())
        if committer_record:
            log("%s committer = %s" % (patch.id(), committer_record))
        return not committer_record
Example #4
0
    def __init__(self, dryrun=False, committers=CommitterList()):
        self.dryrun = dryrun
        self.authenticated = False
        self.queries = BugzillaQueries(self)
        self.committers = committers

        # FIXME: We should use some sort of Browser mock object when in dryrun
        # mode (to prevent any mistakes).
        self.browser = Browser()
        # Ignore bugs.webkit.org/robots.txt until we fix it to allow this
        # script.
        self.browser.set_handle_robots(False)
Example #5
0
    def _assign_bug_to_last_patch_attacher(self, bug_id):
        committers = CommitterList()
        bug = self.tool.bugs.fetch_bug(bug_id)
        assigned_to_email = bug.assigned_to_email()
        if assigned_to_email != self.tool.bugs.unassigned_email:
            log("Bug %s is already assigned to %s (%s)." % (bug_id, assigned_to_email, committers.committer_by_email(assigned_to_email)))
            return

        reviewed_patches = bug.reviewed_patches()
        if not reviewed_patches:
            log("Bug %s has no non-obsolete patches, ignoring." % bug_id)
            return
        latest_patch = reviewed_patches[-1]
        attacher_email = latest_patch.attacher_email()
        committer = committers.committer_by_email(attacher_email)
        if not committer:
            log("Attacher %s is not a committer.  Bug %s likely needs commit-queue+." % (attacher_email, bug_id))
            return

        reassign_message = "Attachment %s was posted by a committer and has review+, assigning to %s for commit." % (latest_patch.id(), committer.full_name)
        self.tool.bugs.reassign_bug(bug_id, committer.bugzilla_email(), reassign_message)
Example #6
0
 def execute(self, options, args, tool):
     committers = CommitterList()
     for bug_id in tool.bugs.queries.fetch_bug_ids_from_pending_commit_list(
     ):
         bug = self.tool.bugs.fetch_bug(bug_id)
         patches = bug.patches(include_obsolete=True)
         for patch in patches:
             flags_to_clear = self._flags_to_clear_on_patch(patch)
             if not flags_to_clear:
                 continue
             message = "Cleared %s from obsolete attachment %s so that this bug does not appear in http://webkit.org/pending-commit." % (
                 flags_to_clear, patch.id())
             self.tool.bugs.obsolete_attachment(patch.id(), message)
Example #7
0
 def __init__(self, committers=CommitterList()):
     AbstractEarlyWarningSystem.__init__(self)
     self._committers = committers
Example #8
0
 def __init__(self):
     Mock.__init__(self)
     self.queries = MockBugzillaQueries(self)
     self.committers = CommitterList(
         reviewers=[Reviewer("Foo Bar", "*****@*****.**")])