get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 812970,
    "url": "http://patchwork.ozlabs.org/api/patches/812970/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912165139.16212-1-berrange@redhat.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170912165139.16212-1-berrange@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-12T16:51:39",
    "name": "[v2] scripts: let checkpatch.pl process an entire GIT branch",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "f3e62f06d1d9a28d54681cb15148a7f209c2ebe4",
    "submitter": {
        "id": 2694,
        "url": "http://patchwork.ozlabs.org/api/people/2694/?format=api",
        "name": "Daniel P. Berrangé",
        "email": "berrange@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170912165139.16212-1-berrange@redhat.com/mbox/",
    "series": [
        {
            "id": 2742,
            "url": "http://patchwork.ozlabs.org/api/series/2742/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2742",
            "date": "2017-09-12T16:51:39",
            "name": "[v2] scripts: let checkpatch.pl process an entire GIT branch",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/2742/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812970/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812970/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com",
            "ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=berrange@redhat.com"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xs9x460Lgz9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 13 Sep 2017 02:58:47 +1000 (AEST)",
            "from localhost ([::1]:37629 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1droWK-0000Yh-Ip\n\tfor incoming@patchwork.ozlabs.org; Tue, 12 Sep 2017 12:58:44 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:33940)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <berrange@redhat.com>) id 1droPb-0002nt-EL\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 12:51:48 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <berrange@redhat.com>) id 1droPY-0007qc-56\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 12:51:47 -0400",
            "from mx1.redhat.com ([209.132.183.28]:35576)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <berrange@redhat.com>) id 1droPX-0007q6-TX\n\tfor qemu-devel@nongnu.org; Tue, 12 Sep 2017 12:51:44 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id E748C5F7A9\n\tfor <qemu-devel@nongnu.org>; Tue, 12 Sep 2017 16:51:42 +0000 (UTC)",
            "from localhost.localdomain.com (unknown [10.42.22.189])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1CB9E77DE3;\n\tTue, 12 Sep 2017 16:51:41 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com E748C5F7A9",
        "From": "\"Daniel P. Berrange\" <berrange@redhat.com>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Tue, 12 Sep 2017 17:51:39 +0100",
        "Message-Id": "<20170912165139.16212-1-berrange@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tTue, 12 Sep 2017 16:51:43 +0000 (UTC)",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]",
        "X-Received-From": "209.132.183.28",
        "Subject": "[Qemu-devel] [PATCH v2] scripts: let checkpatch.pl process an\n\tentire GIT branch",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "Paolo Bonzini <pbonzini@redhat.com>,\n\tMarkus Armbruster <armbru@redhat.com>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "Currently before submitting a series, devs should run checkpatch.pl\nacross each patch to be submitted. This can be automated using a\ncommand such as:\n\n  git rebase -i master -x 'git show | ./scripts/checkpatch.pl -'\n\nThis is rather long winded to type, so this patch introduces a way\nto tell checkpatch.pl to validate a series of GIT revisions.\n\nIf checkpatch.pl is given a single argument that contains a literal\n'..', this is interpreted as a GIT revision list.\n\nFor example:\n\n    $ ./scripts/checkpatch.pl master..\n    total: 0 errors, 0 warnings, 297 lines checked\n\n    b886d352a2bf58f0996471fb3991a138373a2957 has no obvious style problems and is ready for submission.\n    total: 0 errors, 0 warnings, 182 lines checked\n\n    2a731f9a9ce145e0e0df6d42dd2a3ce4dfc543fa has no obvious style problems and is ready for submission.\n    total: 0 errors, 0 warnings, 102 lines checked\n\n    11844169bcc0c8ed4449eb3744a69877ed329dd7 has no obvious style problems and is ready for submission.\n\nIf a genuine patch filename contains the characters '..' it is\npossible to force interpretation of the arg as a patch\n\n  $ ./scripts/checkpatch.pl --patch master..\n\nwill force it to load a patch file called \"master..\"\n\nSigned-off-by: Daniel P. Berrange <berrange@redhat.com>\n---\n scripts/checkpatch.pl | 102 +++++++++++++++++++++++++++++++++++++-------------\n 1 file changed, 77 insertions(+), 25 deletions(-)",
    "diff": "diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl\nindex fa478074b8..213777d488 100755\n--- a/scripts/checkpatch.pl\n+++ b/scripts/checkpatch.pl\n@@ -18,7 +18,8 @@ use Getopt::Long qw(:config no_auto_abbrev);\n my $quiet = 0;\n my $tree = 1;\n my $chk_signoff = 1;\n-my $chk_patch = 1;\n+my $chk_patch = undef;\n+my $chk_branch = undef;\n my $tst_only;\n my $emacs = 0;\n my $terse = 0;\n@@ -35,7 +36,11 @@ sub help {\n \tmy ($exitcode) = @_;\n \n \tprint << \"EOM\";\n-Usage: $P [OPTION]... [FILE]...\n+Usage:\n+\n+    $P [OPTION]... [FILE]...\n+    $P [OPTION]... [GIT-REV-LIST]\n+\n Version: $V\n \n Options:\n@@ -88,6 +93,19 @@ help(0) if ($help);\n \n my $exit = 0;\n \n+if (!defined $chk_patch) {\n+    if (!$file) {\n+\tif ($#ARGV == 0 && $ARGV[0] =~ /\\.\\./) {\n+\t    $chk_branch = $ARGV[0];\n+\t    $chk_patch = 0;\n+\t} else {\n+\t    $chk_patch = 1;\n+\t}\n+    } else {\n+\t$chk_patch = 0;\n+    }\n+}\n+\n if ($#ARGV < 0) {\n \tprint \"$P: no input files\\n\";\n \texit(1);\n@@ -251,32 +269,66 @@ $chk_signoff = 0 if ($file);\n my @rawlines = ();\n my @lines = ();\n my $vname;\n-for my $filename (@ARGV) {\n-\tmy $FILE;\n-\tif ($file) {\n-\t\topen($FILE, '-|', \"diff -u /dev/null $filename\") ||\n-\t\t\tdie \"$P: $filename: diff failed - $!\\n\";\n-\t} elsif ($filename eq '-') {\n-\t\topen($FILE, '<&STDIN');\n-\t} else {\n-\t\topen($FILE, '<', \"$filename\") ||\n-\t\t\tdie \"$P: $filename: open failed - $!\\n\";\n-\t}\n-\tif ($filename eq '-') {\n-\t\t$vname = 'Your patch';\n-\t} else {\n-\t\t$vname = $filename;\n-\t}\n-\twhile (<$FILE>) {\n+if ($chk_branch) {\n+\tmy @patches;\n+\tmy $HASH;\n+\topen($HASH, \"-|\", \"git\", \"log\", \"--format=%H\", $chk_branch) ||\n+\t\tdie \"$P: git log --format=%H $chk_branch failed - $!\\n\";\n+\n+\twhile (<$HASH>) {\n \t\tchomp;\n-\t\tpush(@rawlines, $_);\n+\t\tpush @patches, $_;\n \t}\n-\tclose($FILE);\n-\tif (!process($filename)) {\n-\t\t$exit = 1;\n+\n+\tclose $HASH;\n+\n+\tdie \"$P: no revisions returned for revlist '$chk_branch'\\n\"\n+\t    unless @patches;\n+\n+\tfor my $hash (@patches) {\n+\t\tmy $FILE;\n+\t\topen($FILE, '-|', \"git\", \"show\", $hash) ||\n+\t\t\tdie \"$P: git show $hash - $!\\n\";\n+\t\t$vname = $hash;\n+\t\twhile (<$FILE>) {\n+\t\t\tchomp;\n+\t\t\tpush(@rawlines, $_);\n+\t\t}\n+\t\tclose($FILE);\n+\t\tif (!process($hash)) {\n+\t\t\t$exit = 1;\n+\t\t}\n+\t\t@rawlines = ();\n+\t\t@lines = ();\n+\t}\n+} else {\n+\tfor my $filename (@ARGV) {\n+\t\tmy $FILE;\n+\t\tif ($file) {\n+\t\t\topen($FILE, '-|', \"diff -u /dev/null $filename\") ||\n+\t\t\t\tdie \"$P: $filename: diff failed - $!\\n\";\n+\t\t} elsif ($filename eq '-') {\n+\t\t\topen($FILE, '<&STDIN');\n+\t\t} else {\n+\t\t\topen($FILE, '<', \"$filename\") ||\n+\t\t\t\tdie \"$P: $filename: open failed - $!\\n\";\n+\t\t}\n+\t\tif ($filename eq '-') {\n+\t\t\t$vname = 'Your patch';\n+\t\t} else {\n+\t\t\t$vname = $filename;\n+\t\t}\n+\t\twhile (<$FILE>) {\n+\t\t\tchomp;\n+\t\t\tpush(@rawlines, $_);\n+\t\t}\n+\t\tclose($FILE);\n+\t\tif (!process($filename)) {\n+\t\t\t$exit = 1;\n+\t\t}\n+\t\t@rawlines = ();\n+\t\t@lines = ();\n \t}\n-\t@rawlines = ();\n-\t@lines = ();\n }\n \n exit($exit);\n",
    "prefixes": [
        "v2"
    ]
}