Beispiel #1
0
    def set_commit_status(self,
                          commit,
                          state,
                          target_url,
                          description,
                          context,
                          trim=False):
        """
        Create a status on a commit

        :param commit: The SHA of the commit.
        :param state: The state of the status.
        :param target_url: The target URL to associate with this status.
        :param description: A short description of the status
        :param context: A label to differentiate this status from the status of other systems.
        :param trim: bool Whether to trim the description in order to avoid throwing
            github.GithubException
        :return:
        """
        github_commit = self.github_repo.get_commit(commit)
        if trim:
            description = description[:140]
        status = github_commit.create_status(state, target_url, description,
                                             context)
        return CommitFlag(commit, status.state, status.context,
                          status.description)
Beispiel #2
0
 def _commit_status_from_gitlab_object(raw_status) -> CommitFlag:
     return CommitFlag(
         commit=raw_status.sha,
         state=raw_status.status,
         context=raw_status.name,
         comment=raw_status.description,
         uid=raw_status.id,
         url=raw_status.target_url,
     )
Beispiel #3
0
 def _commit_status_from_pagure_dict(status_dict: dict,
                                     uid: str = None) -> CommitFlag:
     return CommitFlag(
         commit=status_dict["commit_hash"],
         comment=status_dict["comment"],
         state=status_dict["status"],
         context=status_dict["username"],
         url=status_dict["url"],
         uid=uid,
     )
Beispiel #4
0
    def set_commit_status(self, commit, state, target_url, description, context):
        """
        Create a status on a commit

        :param commit: The SHA of the commit.
        :param state: The state of the status.
        :param target_url: The target URL to associate with this status.
        :param description: A short description of the status
        :param context: A label to differentiate this status from the status of other systems.
        :return:
        """
        github_commit = self.github_repo.get_commit(commit)
        github_commit.create_status(state, target_url, description, context)
        return CommitFlag(commit, state, context)
Beispiel #5
0
 def set_commit_status(cls, original_object: Any, commit: str,
                       state: CommitStatus, context: str) -> "CommitFlag":
     return CommitFlag(commit=commit, state=state, context=context)
Beispiel #6
0
 def set_commit_status(
     cls, original_object: Any, commit: str, state: str, context: str
 ) -> "CommitFlag":
     output = CommitFlag(commit, state, context)
     return output