Show a patch.

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

{
    "id": 10740,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10740/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10740/",
    "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": "<20201224122855.22200-5-laurent.pinchart@ideasonboard.com>",
    "date": "2020-12-24T12:28:51",
    "name": "[libcamera-devel,4/8] utils: checkstyle.py: Make title and files properties of commit class",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "37eecab16e028f4794f7e7078ec941686dbb9239",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": {
        "id": 14,
        "url": "https://patchwork.libcamera.org/api/1.1/users/14/?format=api",
        "username": "pinchartl",
        "first_name": "Laurent",
        "last_name": "Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/10740/mbox/",
    "series": [
        {
            "id": 1550,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1550/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1550",
            "date": "2020-12-24T12:28:47",
            "name": "checkstyle.py: Ensure meson.build is updated when adding header",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1550/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10740/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10740/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 3FFBEC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Dec 2020 12:29:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E7C9060526;\n\tThu, 24 Dec 2020 13:29:13 +0100 (CET)",
            "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 58478615D5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:09 +0100 (CET)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED680A1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 13:29:08 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"dyDxFH9S\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1608812949;\n\tbh=z4u4x2raluKiHJaKWTFtx/4Qil1hDuWMhc/94oYSOn0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=dyDxFH9Sn/WkhlM2NEnKSA0W95pbQyOqhS+fUp2bk0KwrPq7XL4XsLQxhujbPaWkE\n\t23oHvQd6ltcN9Jv1wtnLqg9nnsJevP66g5EeyeTUd1PzYpPdW2b+cnSCcur68155R6\n\tEpMlv3e5DFFaY9lP1BkfOiGsfv+pKG7tNQUsrkok=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 24 Dec 2020 14:28:51 +0200",
        "Message-Id": "<20201224122855.22200-5-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20201224122855.22200-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 4/8] utils: checkstyle.py: Make title and\n\tfiles properties of commit class",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Make the API of the Commit class more explicit by exposing the title and\nfiles as properties instead of through a get_info() method.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/checkstyle.py | 34 +++++++++++++++++++++-------------\n 1 file changed, 21 insertions(+), 13 deletions(-)",
    "diff": "diff --git a/utils/checkstyle.py b/utils/checkstyle.py\nindex 4ba65e5a4ff1..77e635dc5154 100755\n--- a/utils/checkstyle.py\n+++ b/utils/checkstyle.py\n@@ -197,15 +197,24 @@ def parse_diff(diff):\n class Commit:\n     def __init__(self, commit):\n         self.commit = commit\n+        self.__parse()\n \n-    def get_info(self):\n+    def __parse(self):\n         # Get the commit title and list of files.\n         ret = subprocess.run(['git', 'show', '--pretty=oneline', '--name-only',\n                               self.commit],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n         files = ret.splitlines()\n-        # Returning title and files list as a tuple\n-        return files[0], files[1:]\n+        self.__files = files[1:]\n+        self.__title = files[0]\n+\n+    @property\n+    def files(self):\n+        return self.__files\n+\n+    @property\n+    def title(self):\n+        return self.__title\n \n     def get_diff(self, top_level, filename):\n         return subprocess.run(['git', 'diff', '%s~..%s' % (self.commit, self.commit),\n@@ -221,10 +230,11 @@ class StagedChanges(Commit):\n     def __init__(self):\n         Commit.__init__(self, '')\n \n-    def get_info(self):\n+    def __parse(self):\n         ret = subprocess.run(['git', 'diff', '--staged', '--name-only'],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n-        return \"Staged changes\", ret.splitlines()\n+        self.__title = \"Staged changes\"\n+        self.__files = ret.splitlines()\n \n     def get_diff(self, top_level, filename):\n         return subprocess.run(['git', 'diff', '--staged', '--',\n@@ -236,15 +246,15 @@ class Amendment(StagedChanges):\n     def __init__(self):\n         StagedChanges.__init__(self)\n \n-    def get_info(self):\n+    def __parse(self):\n         # Create a title using HEAD commit\n         ret = subprocess.run(['git', 'show', '--pretty=oneline', '--no-patch'],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n-        title = 'Amendment of ' + ret.strip()\n+        self.__title = 'Amendment of ' + ret.strip()\n         # Extract the list of modified files\n         ret = subprocess.run(['git', 'diff', '--staged', '--name-only', 'HEAD~'],\n                              stdout=subprocess.PIPE).stdout.decode('utf-8')\n-        return title, ret.splitlines()\n+        self.__files = ret.splitlines()\n \n     def get_diff(self, top_level, filename):\n         return subprocess.run(['git', 'diff', '--staged', 'HEAD~', '--',\n@@ -686,18 +696,16 @@ def check_file(top_level, commit, filename):\n \n \n def check_style(top_level, commit):\n-    title, files = commit.get_info()\n-\n-    separator = '-' * len(title)\n+    separator = '-' * len(commit.title)\n     print(separator)\n-    print(title)\n+    print(commit.title)\n     print(separator)\n \n     # Filter out files we have no checker for.\n     patterns = set()\n     patterns.update(StyleChecker.all_patterns())\n     patterns.update(Formatter.all_patterns())\n-    files = [f for f in files if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n+    files = [f for f in commit.files if len([p for p in patterns if fnmatch.fnmatch(os.path.basename(f), p)])]\n     if len(files) == 0:\n         print(\"Commit doesn't touch source files, skipping\")\n         return 0\n",
    "prefixes": [
        "libcamera-devel",
        "4/8"
    ]
}