def handle(self, request, target_repo=None): m = _instance.pending_series(target_repo).first() if not m: return None response = prepare_series( request, m, fields=["project", "message-id", "patches", "properties", "tags"], ) po = m.project config = _instance.get_project_config(po) for k, v in config.items(): response["git." + k] = v base = _instance.get_base(m) if base: response["git.repo"] = base.data["repo"] response["git.base"] = base.data["tag"] response["project.git"] = po.git response["mbox_uri"] = rest_framework.reverse.reverse( "series-mbox", kwargs={ "projects_pk": m.project_id, "message_id": m.message_id }, request=request, ) response["result_uri"] = reverse_detail(m.git_result, request) response["git.push_options"] = m.git_result.data.get( "git.push_options") return response
def _generate_project_test_data(self, request, project, repo, head, base, result, test): return self._generate_test_data(project=project, repo=repo, head=head, base=base, identity={ "type": "project", "head": head, }, result_uri=reverse_detail( result, request), test=test)
def _generate_series_test_data(self, request, s, result, test): gr = s.git_result assert gr.is_success() return self._generate_test_data(project=s.project.name, repo=gr.data["repo"], head=gr.data["tag"], base=gr.data.get("base", None), identity={ "type": "series", "message-id": s.message_id, "subject": s.subject, }, result_uri=reverse_detail( result, request), test=test)
def handle(self, request): m = Message.objects.filter(results__name="git", results__status="pending").first() if not m: return None response = prepare_series( request, m, fields=["project", "message-id", "patches", "properties"]) po = m.project for prop in ["git.push_to", "git.public_repo", "git.url_template"]: if po.get_property(prop): response[prop] = po.get_property(prop) base = _instance.get_base(m) if base: response["git.repo"] = base.data["repo"] response["git.base"] = base.data["tag"] response["project.git"] = po.git response["result_uri"] = reverse_detail(m.git_result, request) return response
def get_result_uri(self, obj): request = self.context["request"] return reverse_detail(obj.git_result, request)