From nobody Tue May 13 12:58:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524485671899475.8588571069421; Mon, 23 Apr 2018 05:14:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E566280B2A; Mon, 23 Apr 2018 12:14:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D609D6608D; Mon, 23 Apr 2018 12:14:30 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C87C2180596E; Mon, 23 Apr 2018 12:14:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3NCESlK004185 for ; Mon, 23 Apr 2018 08:14:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id CE05A10FFE6D; Mon, 23 Apr 2018 12:14:28 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EFC510FFE74 for ; Mon, 23 Apr 2018 12:14:28 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Mon, 23 Apr 2018 14:14:21 +0200 Message-Id: <20180423121423.21500-3-pbonzini@redhat.com> In-Reply-To: <20180423121423.21500-1-pbonzini@redhat.com> References: <20180423121423.21500-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 2/4] git: add rendering of Results X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 23 Apr 2018 12:14:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- mods/git.py | 62 +++++++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/mods/git.py b/mods/git.py index 1f22f2e..7d33566 100644 --- a/mods/git.py +++ b/mods/git.py @@ -122,7 +122,13 @@ class GitModule(PatchewModule): else: git_repo =3D obj.get_property("git.repo") git_tag =3D obj.get_property("git.tag") - data =3D {'repo': git_repo, 'tag': 'refs/tags/' + git_tag} + git_url =3D obj.get_property("git.url") + data =3D {} + if git_repo and git_tag: + data['repo'] =3D git_repo + data['tag'] =3D 'refs/tags/' + git_tag + if git_url: + data['url'] =3D git_url status =3D 'success' log_url =3D reverse("git-log", kwargs=3D{'series': obj.message= _id}) else: @@ -130,30 +136,19 @@ class GitModule(PatchewModule): log_url =3D None results.append(Result(name=3D'git', obj=3Dobj, status=3Dstatus, log=3Dlog, log_url=3Dlog_url, data=3Ddata, - request=3Drequest)) + request=3Drequest, renderer=3Dself)) =20 def prepare_message_hook(self, request, message, detailed): if not message.is_series_head: return - l =3D message.get_property("git.apply-log") - if l: - failed =3D message.get_property("git.apply-failed") - log_url =3D reverse("git-log", - kwargs=3D{"series": message.message_id}) - html_log_url =3D log_url + "?html=3D1" - colorbox_a =3D format_html('apply log', - html_log_url, log_url) - if failed: + if message.get_property("git.apply-log"): + if message.get_property("git.apply-failed"): title =3D "Failed in applying to current master" message.status_tags.append({ "title": title, "type": "default", "char": "G", }) - message.extra_status.append({ - "kind": "alert", - "html": format_html('{} ({})', title, colorbox_a), - }) else: git_url =3D message.get_property("git.url") git_repo =3D message.get_property("git.repo") @@ -165,25 +160,12 @@ class GitModule(PatchewModule): "type": "info", "char": "G", }) - if git_repo and git_tag: - message.extra_status.append({ - "kind": "good", - "html": format_html('Patches applied successfu= lly (tree, {}).
git fetch {} {}', - git_url, colorbox_a, git_r= epo, git_tag), - }) else: message.status_tags.append({ "title": format_html("Patches applied successfully= "), "type": "info", "char": "G", }) - message.extra_status.append({ - "kind": "good", - "html": format_html('Patches applied successfully = ({})', - colorbox_a), - "extra": colorbox_div, - "id": "gitlog" - }) if request.user.is_authenticated: if message.get_property("git.apply-failed") !=3D None or \ message.get_property("git.need-apply") =3D=3D None: @@ -195,6 +177,30 @@ class GitModule(PatchewModule): "class": "warning", }) =20 + def render_result(self, result): + if result.status =3D=3D 'pending': + return None + + if result.log_url is not None: + html_log_url =3D result.log_url + "?html=3D1" + colorbox_a =3D format_html('apply log', + html_log_url, result.log_url) + if result.status =3D=3D 'failed': + return format_html('Failed in applying to current master (= {})', title, colorbox_a) + else: + if 'url' in result.data: + s =3D format_html('tree, {}', resul= t.data['url'], colorbox_a) + else: + s =3D colorbox_a + s =3D format_html('Patches applied successfully ({})', s) + if 'repo' in result.data and 'tag' in result.data: + git_repo =3D result.data['repo'] + git_tag =3D result.data['tag'] + if git_tag.startswith('refs/tags/'): + git_tag =3D git_tag[5:] + s +=3D format_html('
git fetch {} {}'= , git_repo, git_tag) + return s + def prepare_project_hook(self, request, project): if not project.maintained_by(request.user): return --=20 2.17.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel