From nobody Wed Oct 30 19:55:51 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 1521098877133892.8487157012626; Thu, 15 Mar 2018 00:27:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EB6B9C03675F; Thu, 15 Mar 2018 07:27:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFD9060240; Thu, 15 Mar 2018 07:27:55 +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 D74144CA9D; Thu, 15 Mar 2018 07:27:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2F5cH5d028732 for ; Thu, 15 Mar 2018 01:38:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14C14215CDC6; Thu, 15 Mar 2018 05:38:17 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-59.pek2.redhat.com [10.72.12.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id C53EB215CDA7; Thu, 15 Mar 2018 05:38:15 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Thu, 15 Mar 2018 13:38:11 +0800 Message-Id: <20180315053811.14084-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] Display git HEAD ID if possible 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 15 Mar 2018 07:27:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now we have next.patchew.org, looking at the bottom is the easiest way to tell if the code is updated. Signed-off-by: Fam Zheng --- www/views.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/views.py b/www/views.py index eec226f..1648754 100644 --- a/www/views.py +++ b/www/views.py @@ -17,11 +17,19 @@ from django.urls import reverse from django.conf import settings import api from mod import dispatch_module_hook +import subprocess =20 PAGE_SIZE =3D 50 =20 +def try_get_git_head(): + try: + return "-" + subprocess.check_output(["git", "rev-parse", "--short= ", "HEAD"], + encoding=3D'utf-8') + except: + return "" + def render_page(request, template_name, **data): - data["patchew_version"] =3D settings.VERSION + data["patchew_version"] =3D settings.VERSION + try_get_git_head() dispatch_module_hook("render_page_hook", context_data=3Ddata) return render(request, template_name, context=3Ddata) =20 --=20 2.14.3 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel