From nobody Sat May 4 23:01:37 2024 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 1526913903183700.6848880750372; Mon, 21 May 2018 07:45:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10D7C31CEB1; Mon, 21 May 2018 14:45:02 +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 E9AE430BAFA2; Mon, 21 May 2018 14:45:01 +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 CFB611801242; Mon, 21 May 2018 14:45:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4LEj02M016048 for ; Mon, 21 May 2018 10:45:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2E0E3200BCCB; Mon, 21 May 2018 14:45:00 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-54.ams2.redhat.com [10.36.116.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F4C22017D1F for ; Mon, 21 May 2018 14:44:59 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Mon, 21 May 2018 16:44:57 +0200 Message-Id: <20180521144458.32564-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] git: remove useless result.log_url check 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.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 21 May 2018 14:45:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" result.log_url is not None if and only if result.is_completed() is false, so it is not necessary to check twice for it. Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- mods/git.py | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/mods/git.py b/mods/git.py index 48711db..7d8afbb 100644 --- a/mods/git.py +++ b/mods/git.py @@ -181,25 +181,24 @@ class GitModule(PatchewModule): if not result.is_completed(): return None =20 - 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.is_failure(): - return format_html('Failed in applying to current master (= {})', colorbox_a) + html_log_url =3D result.log_url + "?html=3D1" + colorbox_a =3D format_html('apply log', + html_log_url, result.log_url) + if result.is_failure(): + return format_html('Failed in applying to current master ({})'= , colorbox_a) + else: + if 'url' in result.data: + s =3D format_html('tree, {}', result.da= ta['url'], 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 + 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 {} {}', gi= t_repo, git_tag) + return s =20 def prepare_project_hook(self, request, project): if not project.maintained_by(request.user): --=20 2.17.0 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel