{"id":20805,"url":"https://patchwork.libcamera.org/api/patches/20805/?format=json","web_url":"https://patchwork.libcamera.org/patch/20805/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240805174807.10125-1-laurent.pinchart@ideasonboard.com>","date":"2024-08-05T17:48:06","name":"[1/2] utils: checkstyle.py: Add author property to Commit class","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7bb4214b2a2aa4d16d41b7f2ce4979c908eacb6d","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20805/mbox/","series":[{"id":4489,"url":"https://patchwork.libcamera.org/api/series/4489/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4489","date":"2024-08-05T17:48:06","name":"[1/2] utils: checkstyle.py: Add author property to Commit class","version":1,"mbox":"https://patchwork.libcamera.org/series/4489/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20805/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20805/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 706C4C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Aug 2024 17:48:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5C5A96195D;\n\tMon,  5 Aug 2024 19:48:32 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D6D76195D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Aug 2024 19:48:30 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 98E34581\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Aug 2024 19:47:38 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SWmUI05z\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1722880058;\n\tbh=RNx3x1h7kZtKgwwiiiEc7RoQklSq8F9LQWDbo1/TBSk=;\n\th=From:To:Subject:Date:From;\n\tb=SWmUI05zbGF+I1vGKZzPE9+gHsc+Za7YTaISy7T5FjmM+EN6oHmDlrx0/cOoPJQpf\n\t413dRh2nEd8Op2BfPczK0FKowIr/yj9Mdajws+DrK7whZ34smxADkyETt/VYXuNfm6\n\ttRDiDNx0rnkOeb46j8+77Gtyob7qfWIhCGur2fwQ=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH 1/2] utils: checkstyle.py: Add author property to Commit\n\tclass","Date":"Mon,  5 Aug 2024 20:48:06 +0300","Message-ID":"<20240805174807.10125-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Extend the Commit class with an author property, retrieved from the\ncommit. It will be used to extend checkers.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 16 +++++++++++-----\n 1 file changed, 11 insertions(+), 5 deletions(-)\n\n\nbase-commit: 8af95d6854889dc66746429ccf8888e3a81f6baf","diff":"diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 7d480bdf4a2f..1eeb3809f7fe 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -216,7 +216,7 @@ class Commit:\n         self._parse()\n \n     def _parse_trailers(self, lines):\n-        for index in range(1, len(lines)):\n+        for index in range(2, len(lines)):\n             line = lines[index]\n             if not line:\n                 break\n@@ -227,12 +227,13 @@ class Commit:\n \n     def _parse(self):\n         # Get the commit title and list of files.\n-        ret = subprocess.run(['git', 'show', '--format=%s%n%(trailers:only,unfold)', '--name-status',\n+        ret = subprocess.run(['git', 'show', '--format=%an <%ae>%n%s%n%(trailers:only,unfold)', '--name-status',\n                               self.commit],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n         lines = ret.splitlines()\n \n-        self._title = lines[0]\n+        self._author = lines[0]\n+        self._title = lines[1]\n \n         index = self._parse_trailers(lines)\n         self._files = [CommitFile(f) for f in lines[index:] if f]\n@@ -240,6 +241,10 @@ class Commit:\n     def files(self, filter='AMR'):\n         return [f.filename for f in self._files if f.status in filter]\n \n+    @property\n+    def author(self):\n+        return self._author\n+\n     @property\n     def title(self):\n         return self._title\n@@ -282,12 +287,13 @@ class Amendment(Commit):\n \n     def _parse(self):\n         # Create a title using HEAD commit and parse the trailers.\n-        ret = subprocess.run(['git', 'show', '--format=%H %s%n%(trailers:only,unfold)',\n+        ret = subprocess.run(['git', 'show', '--format=%an <%ae>%n%H %s%n%(trailers:only,unfold)',\n                              '--no-patch'],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n         lines = ret.splitlines()\n \n-        self._title = 'Amendment of ' + lines[0].strip()\n+        self._author = lines[0]\n+        self._title = 'Amendment of ' + lines[1].strip()\n \n         self._parse_trailers(lines)\n \n","prefixes":["1/2"]}