Exemple #1
0
    def _FormatAndPostBugCommentOnComplete(self):
        if not self.comparison_mode:
            # There is no comparison metric.
            title = "<b>%s Job complete. See results below.</b>" % _ROUND_PUSHPIN
            deferred.defer(_PostBugCommentDeferred,
                           self.bug_id,
                           '\n'.join((title, self.url)),
                           _retry_options=RETRY_OPTIONS)
            return

        # There is a comparison metric.
        differences = self.state.Differences()

        if not differences:
            title = "<b>%s Couldn't reproduce a difference.</b>" % _ROUND_PUSHPIN
            deferred.defer(_PostBugCommentDeferred,
                           self.bug_id,
                           '\n'.join((title, self.url)),
                           _retry_options=RETRY_OPTIONS)
            return

        # Include list of Changes.
        difference_details = []
        commit_infos = []
        for change_a, change_b in differences:
            if change_b.patch:
                commit_info = change_b.patch.AsDict()
            else:
                commit_info = change_b.last_commit.AsDict()

            values_a = self.state.ResultValues(change_a)
            values_b = self.state.ResultValues(change_b)
            difference = _FormatDifferenceForBug(commit_info, values_a,
                                                 values_b, self.state.metric)
            difference_details.append(difference)
            commit_infos.append(commit_info)

        # Header.
        commit_cache_key = None
        if len(differences) == 1:
            commit_cache_key = update_bug_with_results._GetCommitHashCacheKey(
                commit_infos[0]['git_hash'])

        owner, sheriff, cc_list = self._ComputePostOwnerSheriffCCList(
            commit_infos)
        # Bring it all together.
        comment = self._FormatComment(difference_details, commit_infos,
                                      sheriff)

        deferred.defer(_UpdatePostAndMergeDeferred,
                       comment,
                       commit_cache_key,
                       self.bug_id,
                       cc_list,
                       owner,
                       _retry_options=RETRY_OPTIONS)
Exemple #2
0
def _GenerateCommitCacheKey(commit_infos):
    commit_cache_key = None
    if len(commit_infos) == 1:
        commit_cache_key = update_bug_with_results._GetCommitHashCacheKey(
            commit_infos[0]['git_hash'])
    return commit_cache_key
 def GenerateCommitCacheKey(self):
     commit_cache_key = None
     if len(self._differences) == 1:
         commit_cache_key = update_bug_with_results._GetCommitHashCacheKey(
             self._differences[0].commit_info.get('git_hash'))
     return commit_cache_key
Exemple #4
0
    def _FormatAndPostBugCommentOnComplete(self):
        if not self.comparison_mode:
            # There is no comparison metric.
            title = "<b>%s Job complete. See results below.</b>" % _ROUND_PUSHPIN
            self._PostBugComment('\n'.join((title, self.url)))
            return

        # There is a comparison metric.
        differences = self.state.Differences()

        if not differences:
            title = "<b>%s Couldn't reproduce a difference.</b>" % _ROUND_PUSHPIN
            self._PostBugComment('\n'.join((title, self.url)))
            return

        # Include list of Changes.
        difference_details = []
        commit_infos = []
        for change_a, change_b in differences:
            if change_b.patch:
                commit_info = change_b.patch.AsDict()
            else:
                commit_info = change_b.last_commit.AsDict()

            values_a = self.state.ResultValues(change_a)
            values_b = self.state.ResultValues(change_b)
            difference = _FormatDifferenceForBug(commit_info, values_a,
                                                 values_b, self.state.metric)
            difference_details.append(difference)
            commit_infos.append(commit_info)

        # Header.
        commit_cache_key = None
        if len(differences) == 1:
            commit_cache_key = update_bug_with_results._GetCommitHashCacheKey(
                commit_infos[0]['git_hash'])

        owner, sheriff, cc_list = self._ComputePostOwnerSheriffCCList(
            commit_infos)
        merge_details, cc_list = self._ComputePostMergeDetails(
            commit_cache_key, cc_list)

        # Bring it all together.
        comment = self._FormatComment(difference_details, commit_infos,
                                      sheriff)

        current_bug_status = self._GetBugStatus()
        if (not current_bug_status or current_bug_status
                in ['Untriaged', 'Unconfirmed', 'Available']):
            # Set the bug status and owner if this bug is opened and unowned.
            self._PostBugComment(comment,
                                 status='Assigned',
                                 cc_list=sorted(cc_list),
                                 owner=owner,
                                 merge_issue=merge_details.get('id'))
        else:
            # Only update the comment and cc list if this bug is assigned or closed.
            self._PostBugComment(comment,
                                 cc_list=sorted(cc_list),
                                 merge_issue=merge_details.get('id'))

        update_bug_with_results.UpdateMergeIssue(commit_cache_key,
                                                 merge_details, self.bug_id)