{"id":20817,"url":"https://patchwork.libcamera.org/api/patches/20817/?format=json","web_url":"https://patchwork.libcamera.org/patch/20817/","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":"<20240807121516.13608-2-laurent.pinchart@ideasonboard.com>","date":"2024-08-07T12:15:14","name":"[v2,1/3] utils: checkstyle.py: Add author property to Commit class","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"4e12d05df75f67602779910afe4e5e5566270324","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/20817/mbox/","series":[{"id":4494,"url":"https://patchwork.libcamera.org/api/series/4494/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4494","date":"2024-08-07T12:15:13","name":"utils: checkstyle.py: Improve trailer validation","version":2,"mbox":"https://patchwork.libcamera.org/series/4494/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20817/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20817/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 DC014BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Aug 2024 12:15:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A5C1633B1;\n\tWed,  7 Aug 2024 14:15:44 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 262AC6337E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2024 14:15:41 +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 489B42EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Aug 2024 14:14:48 +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=\"uzHIrQiX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723032888;\n\tbh=N2CKPecvo37g2Ig/2RCWbU/wseqXUeUtU9rMVo3pM+0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=uzHIrQiXEnPPBXE3yjxnBNAPwEgJA/KP+O3X1TS6VXDRu9/gEfffEibZ6aLt/FQLd\n\tKviD6nftJDEKpgMeM7+hieNO8NbUIDB8Nq488JeozNCGHggMLFSWp4YmwNktuGgHvm\n\tIbb+6GrcJzGNHRXvPvuucpm8GO6vTHuDkniauB4w=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 1/3] utils: checkstyle.py: Add author property to Commit\n\tclass","Date":"Wed,  7 Aug 2024 15:15:14 +0300","Message-ID":"<20240807121516.13608-2-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","In-Reply-To":"<20240807121516.13608-1-laurent.pinchart@ideasonboard.com>","References":"<20240807121516.13608-1-laurent.pinchart@ideasonboard.com>","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\nWhile at it, drop the unneeded .strip() call when retrieving the title\nfor amendment commits. The call got carried over from code that\ninitially needed it to strip the new line character, but that need\ndisappeard with usage of .splitlines().\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nChanges since v1:\n\n- Wrap long line\n- Drop .strip()\n- Initialize _author to None\n---\n utils/checkstyle.py | 19 +++++++++++++------\n 1 file changed, 13 insertions(+), 6 deletions(-)","diff":"diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 7d480bdf4a2f..e8451846c0c2 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -212,11 +212,12 @@ class CommitFile:\n class Commit:\n     def __init__(self, commit):\n         self.commit = commit\n+        self._author = None\n         self._trailers = []\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 +228,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-                              self.commit],\n+        ret = subprocess.run(['git', 'show', '--format=%an <%ae>%n%s%n%(trailers:only,unfold)',\n+                              '--name-status', 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 +242,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 +288,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]\n \n         self._parse_trailers(lines)\n \n","prefixes":["v2","1/3"]}