get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 179815,
    "url": "http://patchwork.ozlabs.org/api/patches/179815/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/1345803102-21110-7-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": "<1345803102-21110-7-git-send-email-gerlando.falauto@keymile.com>",
    "list_archive_url": null,
    "date": "2012-08-24T10:11:41",
    "name": "[U-Boot,v4,6/7] env: make \"env default\" selective, check and apply",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "dc8d60452e8a54195958b6c61a6dd433273fd261",
    "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/1345803102-21110-7-git-send-email-gerlando.falauto@keymile.com/mbox/",
    "series": [],
    "comments": "http://patchwork.ozlabs.org/api/patches/179815/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/179815/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 61D202C00C4\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 24 Aug 2012 20:19:36 +1000 (EST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 76AF02811E;\n\tFri, 24 Aug 2012 12:19:24 +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 qxrLTYVZS0He; Fri, 24 Aug 2012 12:19:24 +0200 (CEST)",
            "from theia.denx.de (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 5E28B28121;\n\tFri, 24 Aug 2012 12:18:52 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n\tby theia.denx.de (Postfix) with ESMTP id 3C55D280C4\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:43 +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 Shl7bIzAuqFW for <u-boot@lists.denx.de>;\n\tFri, 24 Aug 2012 12:18:42 +0200 (CEST)",
            "from mail-de.keymile.com (mail-de.keymile.com [195.8.104.1])\n\tby theia.denx.de (Postfix) with SMTP id 8FA6F2808F\n\tfor <u-boot@lists.denx.de>; Fri, 24 Aug 2012 12:18:42 +0200 (CEST)",
            "from mailrelay.de.keymile.net ([10.9.1.54]) by eSafe SMTP Relay\n\t1345792219; Fri, 24 Aug 2012 12:18:41 +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 q7OAHMjE026728; Fri, 24 Aug 2012 12:17:32 +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": "Fri, 24 Aug 2012 12:11:41 +0200",
        "Message-Id": "<1345803102-21110-7-git-send-email-gerlando.falauto@keymile.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "In-Reply-To": "<1345803102-21110-1-git-send-email-gerlando.falauto@keymile.com>",
        "References": "<1321634955-5561-1-git-send-email-gerlando.falauto@keymile.com><1345803102-21110-1-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 v4 6/7] env: make \"env default\" selective,\n\tcheck and apply",
        "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": "Change the syntax (user API) for \"env default\":\n  -f: override write-once variables\n  var... : accept individual variable(s)\n  -a: all (resetting the whole env is NOT the default behavior)\n\nEnable variable checking and make changes effective by\nenabling do_apply argument to himport_r().\n\nSigned-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>\n---\n common/cmd_nvedit.c   |   40 ++++++++++++++++++++++++++++++++++------\n common/env_common.c   |   28 +++++++++++++++++++++++++++-\n include/environment.h |    3 +++\n 3 files changed, 64 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c\nindex b0860f3..ac2b985 100644\n--- a/common/cmd_nvedit.c\n+++ b/common/cmd_nvedit.c\n@@ -656,14 +656,41 @@ int envmatch(uchar *s1, int i2)\n \treturn -1;\n }\n \n-static int do_env_default(cmd_tbl_t *cmdtp, int flag,\n+static int do_env_default(cmd_tbl_t *cmdtp, int __flag,\n \t\t\t  int argc, char * const argv[])\n {\n-\tif (argc != 2 || strcmp(argv[1], \"-f\") != 0)\n-\t\treturn CMD_RET_USAGE;\n+\tint all = 0, flag = 0;\n \n-\tset_default_env(\"## Resetting to default environment\\n\");\n-\treturn 0;\n+\tdebug(\"Initial value for argc=%d\\n\", argc);\n+\twhile (--argc > 0 && **++argv == '-') {\n+\t\tchar *arg = *argv;\n+\n+\t\twhile (*++arg) {\n+\t\t\tswitch (*arg) {\n+\t\t\tcase 'a':\t\t/* default all */\n+\t\t\t\tall = 1;\n+\t\t\t\tbreak;\n+\t\t\tcase 'f':\t\t/* force */\n+\t\t\t\tflag |= H_FORCE;\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\treturn cmd_usage(cmdtp);\n+\t\t\t}\n+\t\t}\n+\t}\n+\tdebug(\"Final value for argc=%d\\n\", argc);\n+\tif (all && (argc == 0)) {\n+\t\t/* Reset the whole environment */\n+\t\tset_default_env(\"## Resetting to default environment\\n\");\n+\t\treturn 0;\n+\t}\n+\tif (!all && (argc > 0)) {\n+\t\t/* Reset individual variables */\n+\t\tset_default_vars(argc, argv);\n+\t\treturn 0;\n+\t}\n+\n+\treturn cmd_usage(cmdtp);\n }\n \n static int do_env_delete(cmd_tbl_t *cmdtp, int flag,\n@@ -994,7 +1021,8 @@ U_BOOT_CMD(\n #if defined(CONFIG_CMD_ASKENV)\n \t\"ask name [message] [size] - ask for environment variable\\nenv \"\n #endif\n-\t\"default -f - reset default environment\\n\"\n+\t\"default [-f] -a - [forcibly] reset default environment\\n\"\n+\t\"env default [-f] var [...] - [forcibly] reset variable(s) to their default values\\n\"\n #if defined(CONFIG_CMD_EDITENV)\n \t\"env edit name - edit environment variable\\n\"\n #endif\ndiff --git a/common/env_common.c b/common/env_common.c\nindex c6e7c4c..482d715 100644\n--- a/common/env_common.c\n+++ b/common/env_common.c\n@@ -177,6 +177,11 @@ const uchar *env_get_addr(int index)\n \n void set_default_env(const char *s)\n {\n+\t/*\n+\t * By default, do not apply changes as they will eventually\n+\t * be applied by someone else\n+\t */\n+\tint do_apply = 0;\n \tif (sizeof(default_environment) > ENV_SIZE) {\n \t\tputs(\"*** Error - default environment is too large\\n\\n\");\n \t\treturn;\n@@ -188,6 +193,14 @@ void set_default_env(const char *s)\n \t\t\t\t\"using default environment\\n\\n\",\n \t\t\t\ts + 1);\n \t\t} else {\n+\t\t\t/*\n+\t\t\t * This set_to_default was explicitly asked for\n+\t\t\t * by the user, as opposed to being a recovery\n+\t\t\t * mechanism.  Therefore we check every single\n+\t\t\t * variable and apply changes to the system\n+\t\t\t * right away (e.g. baudrate, console).\n+\t\t\t */\n+\t\t\tdo_apply = 1;\n \t\t\tputs(s);\n \t\t}\n \t} else {\n@@ -196,12 +209,25 @@ void set_default_env(const char *s)\n \n \tif (himport_r(&env_htab, (char *)default_environment,\n \t\t\tsizeof(default_environment), '\\0', 0,\n-\t\t\t0, NULL, 0 /* do_apply */) == 0)\n+\t\t\t0, NULL, do_apply) == 0)\n \t\terror(\"Environment import failed: errno = %d\\n\", errno);\n \n \tgd->flags |= GD_FLG_ENV_READY;\n }\n \n+\n+/* [re]set individual variables to their value in the default environment */\n+int set_default_vars(int nvars, char * const vars[])\n+{\n+\t/*\n+\t * Special use-case: import from default environment\n+\t * (and use \\0 as a separator)\n+\t */\n+\treturn himport_r(&env_htab, (const char *)default_environment,\n+\t\t\t\tsizeof(default_environment), '\\0', H_NOCLEAR,\n+\t\t\t\tnvars, vars, 1 /* do_apply */);\n+}\n+\n /*\n  * Check if CRC is valid and (if yes) import the environment.\n  * Note that \"buf\" may or may not be aligned.\ndiff --git a/include/environment.h b/include/environment.h\nindex 90fb130..e8ab703 100644\n--- a/include/environment.h\n+++ b/include/environment.h\n@@ -181,6 +181,9 @@ void env_crc_update(void);\n /* [re]set to the default environment */\n void set_default_env(const char *s);\n \n+/* [re]set individual variables to their value in the default environment */\n+int set_default_vars(int nvars, char * const vars[]);\n+\n /* Import from binary representation into hash table */\n int env_import(const char *buf, int check);\n \n",
    "prefixes": [
        "U-Boot",
        "v4",
        "6/7"
    ]
}