Patch Detail
Show a patch.
GET /api/patches/18892/?format=api
{ "id": 18892, "url": "https://patchwork.libcamera.org/api/patches/18892/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18892/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20230725135547.12589-1-laurent.pinchart@ideasonboard.com>", "date": "2023-07-25T13:55:47", "name": "[libcamera-devel] utils: checkstyle.py: Extract title and trailers with one command", "commit_ref": "4694e441c31378e7c5bfaa34164785bd2f93e38b", "pull_url": null, "state": "accepted", "archived": false, "hash": "bb8ecbe31c1ade9ed9609508c1bb64584065a45c", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/18892/mbox/", "series": [ { "id": 3988, "url": "https://patchwork.libcamera.org/api/series/3988/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3988", "date": "2023-07-25T13:55:47", "name": "[libcamera-devel] utils: checkstyle.py: Extract title and trailers with one command", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3988/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18892/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18892/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 24679BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Jul 2023 13:55:42 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 87A5B61E26;\n\tTue, 25 Jul 2023 15:55:41 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C26161E26\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Jul 2023 15:55:40 +0200 (CEST)", "from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi\n\t[213.243.189.158])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AE4F54AD;\n\tTue, 25 Jul 2023 15:54:41 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1690293341;\n\tbh=Ah3aB3bgi78ML7AYPDDgI7r/hdE2jQg49/6/EaNgC60=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=erhwBIm6JTf/9CAmcmC7l/xtF3/hgCLQ23cUcyTL09elIpzw3RtZawuMXbcBHv3qT\n\tS0dDkqlzkKQkMI/PfjkoAnnJMNCg06J/P94z7NYOhJEW04jyTRhIYzFUZA+VEefYXz\n\t5F22zORq4N794wcFPHX4/zJgJtSHUxd53rQ0/pNC6Txm6/DA+ZNkXXOxAVQULsTCnA\n\tA8n85mPYwWyIQaTsVsE5F+ivE2wmpfmj9PbdFZoqEK/oACy23IV7bG5kMRqertvVTg\n\tvD/MZ2z6uCS6S3/O7Sk+/CfaSqlQMIfg+0IL79B8Gtat3mUQNYa3gTppCdHfOGHzFK\n\teJsQjqEKKpZmw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1690293281;\n\tbh=Ah3aB3bgi78ML7AYPDDgI7r/hdE2jQg49/6/EaNgC60=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=T8MnLSp2jDi7QCOLyAglY4eJdkHbbK1CUanJw2YN3e6VcGyyg/+jdaiduU0whjz38\n\tMobkaCOpjP0itGfA2jirO7ogrJlL7SSdLAq2M3W7UnslN4tIQSXSqCZ9IbLpEMS0ki\n\tMVRoGBHb2Ztq/eab3tPwM4LYUKhXqQlPAOe9g3Gs=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"T8MnLSp2\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 25 Jul 2023 16:55:47 +0300", "Message-Id": "<20230725135547.12589-1-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.39.3", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] utils: checkstyle.py: Extract title and\n\ttrailers with one command", "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>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The Amendment class calls `git show` twice, once to extract the commit\ntitle, and a second time to extract the trailers. This can be combined\nin a single command, which is more efficient. Do so.\n\nWhile at it, centralize initialization of self._trailers in the\nCommit.__init__() function.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 23 ++++++++++-------------\n 1 file changed, 10 insertions(+), 13 deletions(-)\n\n\nbase-commit: baaad1bf9e2acb3ab721945041ef46496951c04c", "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 214509bc74d4..836ea80fe89b 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -206,10 +206,10 @@ class CommitFile:\n class Commit:\n def __init__(self, commit):\n self.commit = commit\n+ self._trailers = []\n self._parse()\n \n def _parse_trailers(self, lines):\n- self._trailers = []\n for index in range(1, len(lines)):\n line = lines[index]\n if not line:\n@@ -257,9 +257,6 @@ class StagedChanges(Commit):\n def __init__(self):\n Commit.__init__(self, '')\n \n- # There are no trailers to parse on a Staged Change.\n- self._trailers = []\n-\n def _parse(self):\n ret = subprocess.run(['git', 'diff', '--staged', '--name-status'],\n stdout=subprocess.PIPE).stdout.decode('utf-8')\n@@ -278,21 +275,21 @@ class Amendment(Commit):\n Commit.__init__(self, '')\n \n def _parse(self):\n- # Create a title using HEAD commit\n- ret = subprocess.run(['git', 'show', '--pretty=oneline', '--no-patch'],\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+ '--no-patch'],\n stdout=subprocess.PIPE).stdout.decode('utf-8')\n- self._title = 'Amendment of ' + ret.strip()\n+ lines = ret.splitlines()\n+\n+ self._title = 'Amendment of ' + lines[0].strip()\n+\n+ self._parse_trailers(lines)\n+\n # Extract the list of modified files\n ret = subprocess.run(['git', 'diff', '--staged', '--name-status', 'HEAD~'],\n stdout=subprocess.PIPE).stdout.decode('utf-8')\n self._files = [CommitFile(f) for f in ret.splitlines()]\n \n- # Parse trailers from the existing commit only.\n- ret = subprocess.run(['git', 'show', '--format=%n%(trailers:only,unfold)',\n- '--no-patch'],\n- stdout=subprocess.PIPE).stdout.decode('utf-8')\n- self._parse_trailers(ret.splitlines())\n-\n def get_diff(self, top_level, filename):\n diff = subprocess.run(['git', 'diff', '--staged', 'HEAD~', '--',\n '%s/%s' % (top_level, filename)],\n", "prefixes": [ "libcamera-devel" ] }