get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 180149,
    "url": "http://patchwork.ozlabs.org/api/patches/180149/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1346053980-5514-1-git-send-email-gerlando.falauto@keymile.com/",
    "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": "<1346053980-5514-1-git-send-email-gerlando.falauto@keymile.com>",
    "list_archive_url": null,
    "date": "2012-08-27T07:53:00",
    "name": "[U-Boot,v5,7/7] env: delete selected vars not present in imported env",
    "commit_ref": "d5370febbcbcee3f554df13ed72b7e2b91e5f66c",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "e3076b6bb167d56b3a8cd62be0c0a1b9f9f5d89c",
    "submitter": {
        "id": 9154,
        "url": "http://patchwork.ozlabs.org/api/people/9154/?format=api",
        "name": "Gerlando Falauto",
        "email": "gerlando.falauto@keymile.com"
    },
    "delegate": {
        "id": 3651,
        "url": "http://patchwork.ozlabs.org/api/users/3651/?format=api",
        "username": "trini",
        "first_name": "Tom",
        "last_name": "Rini",
        "email": "trini@ti.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/1346053980-5514-1-git-send-email-gerlando.falauto@keymile.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/180149/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/180149/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",
        "Received": [
            "from theia.denx.de (theia.denx.de [85.214.87.163])\n\tby ozlabs.org (Postfix) with ESMTP id 3FC802C00C1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 27 Aug 2012 17:53:23 +1000 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id DAC63280A5;\n\tMon, 27 Aug 2012 09:53:20 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id gOn8nKA0FU03; Mon, 27 Aug 2012 09:53:20 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 6CD002809C;\n\tMon, 27 Aug 2012 09:53:19 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 281C22809C\n\tfor <u-boot@lists.denx.de>; Mon, 27 Aug 2012 09:53:17 +0200 (CEST)",
            "from theia.denx.de ([127.0.0.1])\n\tby localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id utio+btjOJAf for <u-boot@lists.denx.de>;\n\tMon, 27 Aug 2012 09:53:15 +0200 (CEST)",
            "from mail-de.keymile.com (mail-de.keymile.com [195.8.104.1])\n\tby theia.denx.de (Postfix) with SMTP id 54E4D28099\n\tfor <u-boot@lists.denx.de>; Mon, 27 Aug 2012 09:53:12 +0200 (CEST)",
            "from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay\n\t1345792219; Mon, 27 Aug 2012 09:53:07 +0200",
            "from chber1-10555x.ch.keymile.net (chber1-10555x.ch.keymile.net\n\t[172.31.40.82]) by mailrelay.de.keymile.net (8.12.2/8.12.2)\n\twith ESMTP id q7R7pvj8014617; Mon, 27 Aug 2012 09:51:59 +0200 (MEST)"
        ],
        "X-Virus-Scanned": [
            "Debian amavisd-new at theia.denx.de",
            "Debian amavisd-new at theia.denx.de"
        ],
        "X-policyd-weight": "NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5\n\tNOT_IN_BL_NJABL=-1.5 (only DNSBL check requested)",
        "From": "Gerlando Falauto <gerlando.falauto@keymile.com>",
        "To": "u-boot@lists.denx.de",
        "Date": "Mon, 27 Aug 2012 09:53:00 +0200",
        "Message-Id": "<1346053980-5514-1-git-send-email-gerlando.falauto@keymile.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "In-Reply-To": "<1345803102-21110-8-git-send-email-gerlando.falauto@keymile.com>",
        "References": "<1345803102-21110-8-git-send-email-gerlando.falauto@keymile.com>",
        "X-ESAFE-STATUS": "[srvhellgate.de.keymile.net] Mail clean",
        "Cc": "marex@denx.de, holger.brunck@keymile.com,\n\tGerlando Falauto <gerlando.falauto@keymile.com>",
        "Subject": "[U-Boot] [PATCH v5 7/7] env: delete selected vars not present in\n\timported env",
        "X-BeenThere": "u-boot@lists.denx.de",
        "X-Mailman-Version": "2.1.11",
        "Precedence": "list",
        "List-Id": "U-Boot discussion <u-boot.lists.denx.de>",
        "List-Unsubscribe": "<http://lists.denx.de/mailman/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>",
        "List-Archive": "<http://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": "<http://lists.denx.de/mailman/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "u-boot-bounces@lists.denx.de",
        "Errors-To": "u-boot-bounces@lists.denx.de"
    },
    "content": "When variables explicitly specified on the command line are not present\nin the imported env, delete them from the running env.\nIf the variable is also missing from the running env, issue a warning.\n\nSigned-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>\n---\nChanges from v4:\n- renamed is_var_in_set to drop_var_from_set\n- removed leading double underscore from vars[] variable name\n---\n lib/hashtable.c |   50 ++++++++++++++++++++++++++++++++++++++++++--------\n 1 file changed, 42 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/lib/hashtable.c b/lib/hashtable.c\nindex f3f47de..670a704 100644\n--- a/lib/hashtable.c\n+++ b/lib/hashtable.c\n@@ -607,22 +607,32 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,\n  * himport()\n  */\n \n-/* Check whether variable name is amongst vars[] */\n-static int is_var_in_set(const char *name, int nvars, char * const vars[])\n+/*\n+ * Check whether variable 'name' is amongst vars[],\n+ * and remove all instances by setting the pointer to NULL\n+ */\n+static int drop_var_from_set(const char *name, int nvars, char * vars[])\n {\n \tint i = 0;\n+\tint res = 0;\n \n \t/* No variables specified means process all of them */\n \tif (nvars == 0)\n \t\treturn 1;\n \n \tfor (i = 0; i < nvars; i++) {\n-\t\tif (!strcmp(name, vars[i]))\n-\t\t\treturn 1;\n+\t\tif (vars[i] == NULL)\n+\t\t\tcontinue;\n+\t\t/* If we found it, delete all of them */\n+\t\tif (!strcmp(name, vars[i])) {\n+\t\t\tvars[i] = NULL;\n+\t\t\tres = 1;\n+\t\t}\n \t}\n-\tdebug(\"Skipping non-listed variable %s\\n\", name);\n+\tif (!res)\n+\t\tdebug(\"Skipping non-listed variable %s\\n\", name);\n \n-\treturn 0;\n+\treturn res;\n }\n \n /*\n@@ -665,6 +675,8 @@ int himport_r(struct hsearch_data *htab,\n \t\tint nvars, char * const vars[], int do_apply)\n {\n \tchar *data, *sp, *dp, *name, *value;\n+\tchar *localvars[nvars];\n+\tint i;\n \n \t/* Test for correct arguments.  */\n \tif (htab == NULL) {\n@@ -681,6 +693,10 @@ int himport_r(struct hsearch_data *htab,\n \tmemcpy(data, env, size);\n \tdp = data;\n \n+\t/* make a local copy of the list of variables */\n+\tif (nvars)\n+\t\tmemcpy(localvars, vars, sizeof(vars[0]) * nvars);\n+\n \tif ((flag & H_NOCLEAR) == 0) {\n \t\t/* Destroy old hash table if one exists */\n \t\tdebug(\"Destroy Hash Table: %p table = %p\\n\", htab,\n@@ -749,7 +765,7 @@ int himport_r(struct hsearch_data *htab,\n \t\t\t*dp++ = '\\0';\t/* terminate name */\n \n \t\t\tdebug(\"DELETE CANDIDATE: \\\"%s\\\"\\n\", name);\n-\t\t\tif (!is_var_in_set(name, nvars, vars))\n+\t\t\tif (!drop_var_from_set(name, nvars, localvars))\n \t\t\t\tcontinue;\n \n \t\t\tif (hdelete_r(name, htab, do_apply) == 0)\n@@ -769,7 +785,7 @@ int himport_r(struct hsearch_data *htab,\n \t\t++dp;\n \n \t\t/* Skip variables which are not supposed to be processed */\n-\t\tif (!is_var_in_set(name, nvars, vars))\n+\t\tif (!drop_var_from_set(name, nvars, localvars))\n \t\t\tcontinue;\n \n \t\t/* enter into hash table */\n@@ -809,6 +825,24 @@ int himport_r(struct hsearch_data *htab,\n \tdebug(\"INSERT: free(data = %p)\\n\", data);\n \tfree(data);\n \n+\t/* process variables which were not considered */\n+\tfor (i = 0; i < nvars; i++) {\n+\t\tif (localvars[i] == NULL)\n+\t\t\tcontinue;\n+\t\t/*\n+\t\t * All variables which were not deleted from the variable list\n+\t\t * were not present in the imported env\n+\t\t * This could mean two things:\n+\t\t * a) if the variable was present in current env, we delete it\n+\t\t * b) if the variable was not present in current env, we notify\n+\t\t *    it might be a typo\n+\t\t */\n+\t\tif (hdelete_r(localvars[i], htab, do_apply) == 0)\n+\t\t\tprintf(\"WARNING: '%s' neither in running nor in imported env!\\n\", localvars[i]);\n+\t\telse\n+\t\t\tprintf(\"WARNING: '%s' not in imported env, deleting it!\\n\", localvars[i]);\n+\t}\n+\n \tdebug(\"INSERT: done\\n\");\n \treturn 1;\t\t/* everything OK */\n }\n",
    "prefixes": [
        "U-Boot",
        "v5",
        "7/7"
    ]
}