Show a patch.

GET /api/1.1/patches/18809/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 18809,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/18809/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/18809/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20230711133915.650485-5-kieran.bingham@ideasonboard.com>",
    "date": "2023-07-11T13:39:15",
    "name": "[libcamera-devel,4/4] utils: checkstyle.py: Check trailers for Amendment commits",
    "commit_ref": "baaad1bf9e2acb3ab721945041ef46496951c04c",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "dd6e89def2849442b4afdf13333e573d24db2f4a",
    "submitter": {
        "id": 4,
        "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api",
        "name": "Kieran Bingham",
        "email": "kieran.bingham@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/18809/mbox/",
    "series": [
        {
            "id": 3966,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3966/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3966",
            "date": "2023-07-11T13:39:11",
            "name": "utils: checkstyle.py: Fix Trailer handling",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/3966/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/18809/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/18809/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 1044DC32AB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Jul 2023 13:39:26 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 89745628CD;\n\tTue, 11 Jul 2023 15:39:24 +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 2BEDA628C2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jul 2023 15:39:21 +0200 (CEST)",
            "from Monstersaurus.local\n\t(aztw-30-b2-v4wan-166917-cust845.vm26.cable.virginm.net\n\t[82.37.23.78])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4C8669B9;\n\tTue, 11 Jul 2023 15:38:32 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689082764;\n\tbh=TRA2z1UJ6KXNTA4/vzT75gmTmgHKD5IvTMrfUMl6Rds=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=J862Gg8GH6aR5qhdktODjf4J6k/xiqZKGZIWzTvixecc9pwUKxEyQL1S5nbbWGb1a\n\tilVfoopnUFGb+cCYKog/296bku3HbCSHowHjBS7e6/tAhoExmNp/FB7r38OW27SA3o\n\t5rPe1Xo93kjo0PLnmSAtHeZTBlaaW5AvJ0Dl8esbEGlwqiiBxfuc0ulEgdLgs4oVfa\n\tEOW/dRNCE4GtAg12jUxPWiGphtRwtGi7jpKvP7lsxF1vN7wkfjO06020EHtvmhKXbU\n\tNA9OBVP+N+OIgtlcx/oB504bfSHxR2ZIt66AFd0hSI+7+XP0aq4dAgJP5M5qy2tXt6\n\tt6Xj9324K3lkA==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1689082712;\n\tbh=TRA2z1UJ6KXNTA4/vzT75gmTmgHKD5IvTMrfUMl6Rds=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GOCinDyn3orzzcgIehyI/smAJgZFtINOWyah6KlL5WFjOXrt/yAXBtQqvYXzTCKdg\n\tNkYxUVvElmSGIYukZsn09XYzL/x4MeDPjEIG9h5v52VAO5wgMfGMf4M6t38+J/7evu\n\ta5duDwl+o56TCpGv7WexR5DqlfS0xiXJ8O3DXL4I="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GOCinDyn\"; dkim-atps=neutral",
        "To": "libcamera devel <libcamera-devel@lists.libcamera.org>",
        "Date": "Tue, 11 Jul 2023 14:39:15 +0100",
        "Message-Id": "<20230711133915.650485-5-kieran.bingham@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230711133915.650485-1-kieran.bingham@ideasonboard.com>",
        "References": "<20230711133915.650485-1-kieran.bingham@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 4/4] utils: checkstyle.py: Check trailers\n\tfor Amendment commits",
        "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": "Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Kieran Bingham <kieran.bingham@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The commit trailers are checked as part of processing the commit message\nwith the newly introduced TrailersChecker.\n\nThis relies on the trailers property being correctly exposed by the\nCommit object, and is implemented for the base Commit but not processed\nfor Amendment commits.\n\nRefactor the trailer property handling to a helper function in the base\nCommit class and make use of it with a newly added call to obtain the\nexisting Trailers from the most recent commit when using Amendment.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n utils/checkstyle.py | 26 ++++++++++++++++++--------\n 1 file changed, 18 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 5663af811961..214509bc74d4 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -208,6 +208,17 @@ class Commit:\n         self.commit = commit\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+                break\n+\n+            self._trailers.append(line)\n+\n+        return index\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@@ -217,14 +228,7 @@ class Commit:\n \n         self._title = lines[0]\n \n-        self._trailers = []\n-        for index in range(1, len(lines)):\n-            line = lines[index]\n-            if not line:\n-                break\n-\n-            self._trailers.append(line)\n-\n+        index = self._parse_trailers(lines)\n         self._files = [CommitFile(f) for f in lines[index:] if f]\n \n     def files(self, filter='AMR'):\n@@ -283,6 +287,12 @@ class Amendment(Commit):\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",
        "4/4"
    ]
}