From nobody Sat Apr 27 03:42:05 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 1521194908906399.2982590691702; Fri, 16 Mar 2018 03:08:28 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C97867FEB0; Fri, 16 Mar 2018 10:08:27 +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 BF6DF5D725; Fri, 16 Mar 2018 10:08:27 +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 1562B4CA99; Fri, 16 Mar 2018 10:08:26 +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 w2GA7jh0027165 for ; Fri, 16 Mar 2018 06:07:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A0A74215CDA7; Fri, 16 Mar 2018 10:07:45 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-50.ams2.redhat.com [10.36.116.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 344712166BB2 for ; Fri, 16 Mar 2018 10:07:45 +0000 (UTC) From: Paolo Bonzini To: patchew-devel@redhat.com Date: Fri, 16 Mar 2018 11:07:44 +0100 Message-Id: <20180316100744.19558-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH] get_diff_stat improvements 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 16 Mar 2018 10:08:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" - Recognize mode change lines and 0-line diffstats from mode changes - File modes must be at least one character long --- api/models.py | 5 +++-- tests/test_model.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/api/models.py b/api/models.py index 277c112..38426cc 100644 --- a/api/models.py +++ b/api/models.py @@ -507,11 +507,12 @@ class Message(models.Model): return None state =3D "" cur =3D [] - patterns =3D [r"\S*\s*\|\s*[0-9]* \+*-*$", + patterns =3D [r"\S*\s*\|\s*[0-9]*( \+*-*)?$", r"\S* =3D> \S*\s*|\s*[0-9]* \+*-*$", r"[0-9]* files changed", r"1 file changed", - r"(create|delete) mode [0-7]*", + r"(create|delete) mode [0-7]+", + r"mode change [0-7]+", r"rename ", ] ret =3D [] diff --git a/tests/test_model.py b/tests/test_model.py index 250a922..a542136 100755 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -21,7 +21,7 @@ class ImportTest(PatchewTestCase): self.cli_login() self.add_project("QEMU", "qemu-devel@nongnu.org") =20 - def test_get_diff_state(self): + def test_get_diff_stat(self): expected =3D """ MAINTAINERS | 7 + Makefile | 9 +- @@ -112,5 +112,32 @@ create mode 100644 util/authz.c self.maxDiff =3D 100000 self.assertMultiLineEqual(expected.strip(), msg.get_diff_stat()) =20 + def test_mode_change_diff_stat(self): + expected =3D """ +tests/qemu-iotests/096 | 0 +tests/qemu-iotests/129 | 0 +tests/qemu-iotests/132 | 0 +tests/qemu-iotests/136 | 0 +tests/qemu-iotests/139 | 0 +tests/qemu-iotests/148 | 0 +tests/qemu-iotests/152 | 0 +tests/qemu-iotests/163 | 0 +tests/qemu-iotests/205 | 0 +9 files changed, 0 insertions(+), 0 deletions(-) +mode change 100644 =3D> 100755 tests/qemu-iotests/096 +mode change 100644 =3D> 100755 tests/qemu-iotests/129 +mode change 100644 =3D> 100755 tests/qemu-iotests/132 +mode change 100644 =3D> 100755 tests/qemu-iotests/136 +mode change 100644 =3D> 100755 tests/qemu-iotests/139 +mode change 100644 =3D> 100755 tests/qemu-iotests/148 +mode change 100644 =3D> 100755 tests/qemu-iotests/152 +mode change 100644 =3D> 100755 tests/qemu-iotests/163 +mode change 100644 =3D> 100755 tests/qemu-iotests/205 +""" + self.cli_import("0021-mode-only-patch.mbox.gz") + msg =3D Message.objects.first() + self.maxDiff =3D 100000 + self.assertMultiLineEqual(expected.strip(), msg.get_diff_stat()) + if __name__ =3D=3D '__main__': main() --=20 2.16.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel