get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1558712,
    "url": "http://patchwork.ozlabs.org/api/patches/1558712/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/20211123180354.615946-6-sjg@chromium.org/",
    "project": {
        "id": 18,
        "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api",
        "name": "U-Boot",
        "link_name": "uboot",
        "list_id": "u-boot.lists.denx.de",
        "list_email": "u-boot@lists.denx.de",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20211123180354.615946-6-sjg@chromium.org>",
    "list_archive_url": null,
    "date": "2021-11-23T18:03:42",
    "name": "[05/17] binman: Add a way to obtain the version",
    "commit_ref": "c475decf59a6460bbd706199d8157f2fd2c4f4fc",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "cca7ee4cdc51424c6fe56caf7d095346fc362ff0",
    "submitter": {
        "id": 6170,
        "url": "http://patchwork.ozlabs.org/api/people/6170/?format=api",
        "name": "Simon Glass",
        "email": "sjg@chromium.org"
    },
    "delegate": {
        "id": 3184,
        "url": "http://patchwork.ozlabs.org/api/users/3184/?format=api",
        "username": "sjg",
        "first_name": "Simon",
        "last_name": "Glass",
        "email": "sjg@chromium.org"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/20211123180354.615946-6-sjg@chromium.org/mbox/",
    "series": [
        {
            "id": 273476,
            "url": "http://patchwork.ozlabs.org/api/series/273476/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=273476",
            "date": "2021-11-23T18:03:37",
            "name": "binman: Various tidy-ups and refactors",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/273476/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1558712/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1558712/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<u-boot-bounces@lists.denx.de>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "bilbo.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256\n header.s=google header.b=J2jjphBB;\n\tdkim-atps=neutral",
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>)",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de",
            "phobos.denx.de;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=chromium.org header.i=@chromium.org\n header.b=\"J2jjphBB\";\n\tdkim-atps=neutral",
            "phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=chromium.org",
            "phobos.denx.de;\n spf=pass smtp.mailfrom=sjg@chromium.org"
        ],
        "Received": [
            "from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange X25519 server-signature RSA-PSS (4096 bits))\n\t(No client certificate requested)\n\tby bilbo.ozlabs.org (Postfix) with ESMTPS id 4HzBrT5B55z9ssD\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 24 Nov 2021 05:05:29 +1100 (AEDT)",
            "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 5A65A83738;\n\tTue, 23 Nov 2021 19:04:52 +0100 (CET)",
            "by phobos.denx.de (Postfix, from userid 109)\n id 6FF9C8373A; Tue, 23 Nov 2021 19:04:29 +0100 (CET)",
            "from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com\n [IPv6:2607:f8b0:4864:20::22b])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id CC700836C5\n for <u-boot@lists.denx.de>; Tue, 23 Nov 2021 19:04:18 +0100 (CET)",
            "by mail-oi1-x22b.google.com with SMTP id u74so46039046oie.8\n for <u-boot@lists.denx.de>; Tue, 23 Nov 2021 10:04:18 -0800 (PST)",
            "from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net.\n [67.190.101.114])\n by smtp.gmail.com with ESMTPSA id c8sm2357514otk.40.2021.11.23.10.04.16\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 23 Nov 2021 10:04:16 -0800 (PST)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,\n DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,\n SPF_PASS autolearn=ham autolearn_force=no version=3.4.2",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n s=google;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=oZa7jscozvNqIFNjY2s1lzqjgiaerjj7XxIRBL4bkRQ=;\n b=J2jjphBByg61Q6BVxnavdX529pyrxYF85B/mvpPoRKbqkuavjNZswFp3Z2vjn/WUmV\n HGuSPPJsUL+T6r/4AThjUXeVF54EkDrvBsKWWdjZ3po1l1yW099hs48eTciER3TTd/r8\n mAroHjDMiEkhTVWxKIVf6z7bdakkNp10tVF5k=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20210112;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=oZa7jscozvNqIFNjY2s1lzqjgiaerjj7XxIRBL4bkRQ=;\n b=13MAX7pvNFcCRQAmQdFj/ENCEwoGFssOGj1h/Npq6HVk2yQSk6fqZB6JWC3xCRhVnT\n bHfChZ2J8C3wJMJWBaMCK1bvWTJ0w0f1h1KqvlInnv1CjDzo1zPB9FQjEagPLcx8AUAg\n U4buEy6DTp4IqJLvAq3aNFbhK6XiOdlp43onI/f8vKTVrQLDD7bSIWEX/poBORj1zezw\n NHiceAluFro+jP72I2MNaE/KwuWHV0aeA2Var0zXiQ8L37rNZOgmqIrbN2Gsj0GZnezY\n yjQOfdPuboDXe6Vv1afeOCRE/LnEZc2XxOuXbvmv5P7gm8vfPc7d6Wiv7KHPis6hNbnQ\n fIZw==",
        "X-Gm-Message-State": "AOAM530y3abPvZ9ea7Og1eStj+IpHHfSB2yqt008+cfPbr8w9otux5H+\n 67f3nCxJWqTFQeHglkSAn9yijuzJZKdv9A==",
        "X-Google-Smtp-Source": "\n ABdhPJy1FLksiWhqj/zm7uW71yqXJgdOvUFmTYFbDH6if6lrQzK8c6VylPjYAukcOMQl86Fe15/5ug==",
        "X-Received": "by 2002:aca:2b0f:: with SMTP id i15mr4461575oik.114.1637690657239;\n Tue, 23 Nov 2021 10:04:17 -0800 (PST)",
        "From": "Simon Glass <sjg@chromium.org>",
        "To": "U-Boot Mailing List <u-boot@lists.denx.de>",
        "Cc": "Tom Rini <trini@konsulko.com>,\n\tSimon Glass <sjg@chromium.org>",
        "Subject": "[PATCH 05/17] binman: Add a way to obtain the version",
        "Date": "Tue, 23 Nov 2021 11:03:42 -0700",
        "Message-Id": "<20211123180354.615946-6-sjg@chromium.org>",
        "X-Mailer": "git-send-email 2.34.0.rc2.393.gf8c9666880-goog",
        "In-Reply-To": "<20211123180354.615946-1-sjg@chromium.org>",
        "References": "<20211123180354.615946-1-sjg@chromium.org>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.37",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<https://lists.denx.de/pipermail/u-boot/>",
        "List-Post": "<mailto:u-boot@lists.denx.de>",
        "List-Help": "<mailto:u-boot-request@lists.denx.de?subject=help>",
        "List-Subscribe": "<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "Errors-To": "u-boot-bounces@lists.denx.de",
        "Sender": "\"U-Boot\" <u-boot-bounces@lists.denx.de>",
        "X-Virus-Scanned": "clamav-milter 0.103.2 at phobos.denx.de",
        "X-Virus-Status": "Clean"
    },
    "content": "Add a -V option which shows the version number of binman. For now this\njust uses a local 'version' file. Once the tool is packaged in some way\nwe can figure out an approach that suits.\n\nSigned-off-by: Simon Glass <sjg@chromium.org>\n---\n\n tools/binman/cmdline.py | 29 +++++++++++++++++++++++++++++\n tools/binman/ftest.py   | 20 ++++++++++++++++++++\n tools/binman/state.py   | 18 ++++++++++++++++++\n 3 files changed, 67 insertions(+)",
    "diff": "diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py\nindex 14ec95c25be..2229316f10e 100644\n--- a/tools/binman/cmdline.py\n+++ b/tools/binman/cmdline.py\n@@ -5,7 +5,9 @@\n \n \"\"\"Command-line parser for binman\"\"\"\n \n+import argparse\n from argparse import ArgumentParser\n+import state\n \n def make_extract_parser(subparsers):\n     \"\"\"make_extract_parser: Make a subparser for the 'extract' command\n@@ -26,6 +28,32 @@ def make_extract_parser(subparsers):\n     extract_parser.add_argument('-U', '--uncompressed', action='store_true',\n         help='Output raw uncompressed data for compressed entries')\n \n+\n+#pylint: disable=R0903\n+class BinmanVersion(argparse.Action):\n+    \"\"\"Handles the -V option to binman\n+\n+    This reads the version information from a file called 'version' in the same\n+    directory as this file.\n+\n+    If not present it assumes this is running from the U-Boot tree and collects\n+    the version from the Makefile.\n+\n+    The format of the version information is three VAR = VALUE lines, for\n+    example:\n+\n+        VERSION = 2022\n+        PATCHLEVEL = 01\n+        EXTRAVERSION = -rc2\n+    \"\"\"\n+    def __init__(self, nargs=0, **kwargs):\n+        super().__init__(nargs=nargs, **kwargs)\n+\n+    def __call__(self, parser, namespace, values, option_string=None):\n+        parser._print_message(f'Binman {state.GetVersion()}\\n')\n+        parser.exit()\n+\n+\n def ParseArgs(argv):\n     \"\"\"Parse the binman command-line arguments\n \n@@ -59,6 +87,7 @@ controlled by a description in the board device tree.'''\n     parser.add_argument('-v', '--verbosity', default=1,\n         type=int, help='Control verbosity: 0=silent, 1=warnings, 2=notices, '\n         '3=info, 4=detail, 5=debug')\n+    parser.add_argument('-V', '--version', nargs=0, action=BinmanVersion)\n \n     subparsers = parser.add_subparsers(dest='cmd')\n     subparsers.required = True\ndiff --git a/tools/binman/ftest.py b/tools/binman/ftest.py\nindex 6be003786e8..6a36e8f3158 100644\n--- a/tools/binman/ftest.py\n+++ b/tools/binman/ftest.py\n@@ -4661,6 +4661,26 @@ class TestFunctional(unittest.TestCase):\n             str(e.exception),\n             \"Not enough space in '.*u_boot_binman_embed_sm' for data length.*\")\n \n+    def testVersion(self):\n+        \"\"\"Test we can get the binman version\"\"\"\n+        version = '(unreleased)'\n+        self.assertEqual(version, state.GetVersion(self._indir))\n+\n+        with self.assertRaises(SystemExit):\n+            with test_util.capture_sys_output() as (_, stderr):\n+                self._DoBinman('-V')\n+        self.assertEqual('Binman %s\\n' % version, stderr.getvalue())\n+\n+        # Try running the tool too, just to be safe\n+        result = self._RunBinman('-V')\n+        self.assertEqual('Binman %s\\n' % version, result.stderr)\n+\n+        # Set up a version file to make sure that works\n+        version = 'v2025.01-rc2'\n+        tools.WriteFile(os.path.join(self._indir, 'version'), version,\n+                        binary=False)\n+        self.assertEqual(version, state.GetVersion(self._indir))\n+\n \n if __name__ == \"__main__\":\n     unittest.main()\ndiff --git a/tools/binman/state.py b/tools/binman/state.py\nindex 9e5b8a39310..af0a65e8418 100644\n--- a/tools/binman/state.py\n+++ b/tools/binman/state.py\n@@ -16,6 +16,8 @@ import os\n from patman import tools\n from patman import tout\n \n+OUR_PATH = os.path.dirname(os.path.realpath(__file__))\n+\n # Map an dtb etype to its expected filename\n DTB_TYPE_FNAME = {\n     'u-boot-spl-dtb': 'spl/u-boot-spl.dtb',\n@@ -515,3 +517,19 @@ def TimingShow():\n \n     for name, seconds in duration.items():\n         print('%10s: %10.1fms' % (name, seconds * 1000))\n+\n+def GetVersion(path=OUR_PATH):\n+    \"\"\"Get the version string for binman\n+\n+    Args:\n+        path: Path to 'version' file\n+\n+    Returns:\n+        str: String version, e.g. 'v2021.10'\n+    \"\"\"\n+    version_fname = os.path.join(path, 'version')\n+    if os.path.exists(version_fname):\n+        version = tools.ReadFile(version_fname, binary=False)\n+    else:\n+        version = '(unreleased)'\n+    return version\n",
    "prefixes": [
        "05/17"
    ]
}