Пример #1
0
    def pull_request_obj(self):
        repo = self.repository_obj
        number = self.pull_request['number']

        try:
            pull = PullRequest.objects.get(repository=repo, number=number)
        except PullRequest.DoesNotExist:
            pull = PullRequest(
                repository=repo,
                number=number,
                name=self.pull_request['title'],
                message=self.pull_request['body'],
                source_branch=self.source_branch_obj,
                target_branch=self.target_branch_obj,
                github_user=self.pull_request_user_obj,
                head_sha=self.pull_request['head']['sha'],
                base_sha=self.pull_request['base']['sha'],
            )
            pull.save()
        return pull
Пример #2
0
    def pull_request_obj(self):
        repo = self.repository_obj
        number = self.pull_request['number']

        try:
            pull = PullRequest.objects.get(repository=repo, number=number)
        except PullRequest.DoesNotExist:
            pull = PullRequest(
                repository = repo,
                number = number,
                name = self.pull_request['title'],
                message = self.pull_request['body'],
                source_branch = self.source_branch_obj,
                target_branch = self.target_branch_obj,
                github_user = self.pull_request_user_obj,
                head_sha = self.pull_request['head']['sha'],
                base_sha = self.pull_request['base']['sha'],
            )
            pull.save()
        return pull
Пример #3
0
    def pull_request_obj(self):
        repo = self.repository_obj

        try:
            pull = PullRequest.objects.get(repository=repo, number=self.number)
            pull.head_sha = self.source_branch['sha']
            pull.base_sha = self.target_branch['sha']
            pull.state = self.state
            pull.save()
        except PullRequest.DoesNotExist:
            pull = PullRequest(
                repository=repo,
                number=self.number,
                name=self.title,
                state=self.state,
                message=self.body,
                source_branch=self.source_branch_obj,
                target_branch=self.target_branch_obj,
                github_user=self.github_user_obj,
                head_sha=self.source_branch['sha'],
                base_sha=self.target_branch['sha'],
            )
            pull.save()
        return pull
Пример #4
0
    def pull_request_obj(self):
        repo = self.repository_obj

        try:
            pull = PullRequest.objects.get(repository=repo, number=self.number)
            pull.head_sha = self.source_branch['sha']
            pull.base_sha = self.target_branch['sha']
            pull.state = self.state
            pull.save()
        except PullRequest.DoesNotExist:
            pull = PullRequest(
                repository = repo,
                number = self.number,
                name = self.title,
                state = self.state,
                message = self.body,
                source_branch = self.source_branch_obj,
                target_branch = self.target_branch_obj,
                github_user = self.github_user_obj,
                head_sha = self.source_branch['sha'],
                base_sha = self.target_branch['sha'],
            )
            pull.save()
        return pull