get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 134678,
    "url": "https://patches.dpdk.org/api/patches/134678/?format=api",
    "web_url": "https://patches.dpdk.org/project/ci/patch/20231128210155.1388785-3-aconole@redhat.com/",
    "project": {
        "id": 5,
        "url": "https://patches.dpdk.org/api/projects/5/?format=api",
        "name": "CI",
        "link_name": "ci",
        "list_id": "ci.dpdk.org",
        "list_email": "ci@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dpdk-ci",
        "webscm_url": "https://git.dpdk.org/tools/dpdk-ci/",
        "list_archive_url": "https://inbox.dpdk.org/ci",
        "list_archive_url_format": "https://inbox.dpdk.org/ci/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231128210155.1388785-3-aconole@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20231128210155.1388785-3-aconole@redhat.com",
    "date": "2023-11-28T21:01:53",
    "name": "[v3,2/3] recheck: Add a recheck parser for patchwork comments",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5a7ecc9ccd30d7b06c90ac4e9e6adb081a7a5c37",
    "submitter": {
        "id": 332,
        "url": "https://patches.dpdk.org/api/people/332/?format=api",
        "name": "Aaron Conole",
        "email": "aconole@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/ci/patch/20231128210155.1388785-3-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 30408,
            "url": "https://patches.dpdk.org/api/series/30408/?format=api",
            "web_url": "https://patches.dpdk.org/project/ci/list/?series=30408",
            "date": "2023-11-28T21:01:52",
            "name": "Add a recheck framework to pw-ci",
            "version": 3,
            "mbox": "https://patches.dpdk.org/series/30408/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/134678/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/134678/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ci-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 90BEB433F9;\n\tTue, 28 Nov 2023 22:02:03 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 32FAD42E22;\n\tTue, 28 Nov 2023 22:02:03 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id 1D0F042E0F\n for <ci@dpdk.org>; Tue, 28 Nov 2023 22:02:02 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-606-vY9N4Sk2PgmISIPb67LGQA-1; Tue, 28 Nov 2023 16:01:57 -0500",
            "from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com\n [10.11.54.2])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 94AF280C348;\n Tue, 28 Nov 2023 21:01:57 +0000 (UTC)",
            "from RHTPC1VM0NT.lan (unknown [10.22.32.221])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 3B19240C6E83;\n Tue, 28 Nov 2023 21:01:57 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1701205321;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=2oEy9z1NvA0f7c4BKQBVKUr2NXhFvmmso1rIyeV3L7Y=;\n b=bdWRCh9iHpEc9LAMONczN06pNU517Opn/cGLF0mIQCMgGHFUMwb1f6ei3fJBJzXJCj5Y7l\n W1I44rJtW5zzqX8n2esMmdvDiBG7IHdxO/47/cJdYZ9BKS1j6NhrI20VEGNng11jaYmTMu\n c04D5SicnO/dhrDMj1yjafkldZWTi6w=",
        "X-MC-Unique": "vY9N4Sk2PgmISIPb67LGQA-1",
        "From": "Aaron Conole <aconole@redhat.com>",
        "To": "ci@dpdk.org",
        "Cc": "Michael Santana <msantana@redhat.com>,\n David Marchand <dmarchan@redhat.com>,\n Thomas Monjalon <thomas@monjalon.net>, Patrick Robb <probb@iol.unh.edu>,\n Dumitru Ceara <dceara@redhat.com>",
        "Subject": "[PATCH v3 2/3] recheck: Add a recheck parser for patchwork comments",
        "Date": "Tue, 28 Nov 2023 16:01:53 -0500",
        "Message-ID": "<20231128210155.1388785-3-aconole@redhat.com>",
        "In-Reply-To": "<20231128210155.1388785-1-aconole@redhat.com>",
        "References": "<20231128210155.1388785-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.2",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "ci@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK CI discussions <ci.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/ci>,\n <mailto:ci-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/ci/>",
        "List-Post": "<mailto:ci@dpdk.org>",
        "List-Help": "<mailto:ci-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/ci>,\n <mailto:ci-request@dpdk.org?subject=subscribe>",
        "Errors-To": "ci-bounces@dpdk.org"
    },
    "content": "Add a recheck parsing tool that will allow for labs to build a\nrecheck workflow based on specific recheck labels and projects,\nwith an associated state machine and querying interface.\n\nThe output of the recheck parsing tool is json and can be fed to\njq or other json parsing utilities for better field support.\n\nAcked-by: Michael Santana <msantana@redhat.com>\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n---\n RECHECK.rst      |  81 ++++++++++++++++++++++++++++++++++++++\n pw_mon           |  59 +++++++++++++++++++++++++++-\n recheck_tool     | 100 +++++++++++++++++++++++++++++++++++++++++++++++\n series_db_lib.sh |  72 +++++++++++++++++++++++++++++++++-\n 4 files changed, 310 insertions(+), 2 deletions(-)\n create mode 100644 RECHECK.rst\n create mode 100755 recheck_tool",
    "diff": "diff --git a/RECHECK.rst b/RECHECK.rst\nnew file mode 100644\nindex 0000000..080f397\n--- /dev/null\n+++ b/RECHECK.rst\n@@ -0,0 +1,81 @@\n+..\n+      Licensed under the terms of the GNU General Public License as published\n+      by the Free Software Foundation; either version 2 of the License, or\n+      (at your option) any later version.  You may obtain a copy of the\n+      license at\n+\n+         https://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n+\n+      Unless required by applicable law or agreed to in writing, software\n+      distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+      WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+      License for the specific language governing permissions and limitations\n+      under the License.\n+\n+\n+============================\n+Recheck Requests\n+============================\n+\n+Various testing labs performing CI testing on new patch series send\n+their results to the appropriate mailing lists for a pw-ci monitor\n+to collect the reports and publish them to patchwork.  On each\n+patch in the series, the results will appear with test category\n+contexts corresponding to the various test types which are run.\n+Examples include github-<worfklow>, travis-ci, etc.\n+\n+If a reported failure on a series seems suspicious to the patch submitter\n+or maintainer, then there may be an interest in requesting a retest on the\n+series for the failing label(s) in order to verify the failure is not\n+spurious or a false positive. This retest demonstrates to the submitter or\n+maintainer that the failure can be reliably reproduced. Unfortunately, at\n+present, the best way to accomplish this is to reach out to lab maintainers\n+via email or Slack. This is not ideal for developers in need of quick test\n+results.\n+\n+Going forward, CI testing labs have the option to implement a request for\n+retest of their respective test labels on patchwork via emails sent to the\n+developer mailing list.  This is accomplished using the the `recheck_tool`\n+to advance the retest check state through various points.\n+\n+An example might look like::\n+\n+  $ export PROJ=foo\n+  $ export INST=patches.foo.com\n+  $ export FILTER=foo-ci\n+  $ export FOO_TOKEN=abcd1234!@$%\n+  $ ./pw_mon --pw-project=$PROJ --pw-instance=$INST \\\n+    --add-filter-recheck=$FILTER\n+\n+  $ for recheck in $(./recheck_tool --pw-project=$PROJ --pw-instance=$INST \\\n+                                    --filter=$FILTER --state=0); do\n+        echo \"Asking for retest $recheck\"\n+        SERIES=$(echo $recheck | jq -rc '.series_id')\n+        SHA=$(echo $recheck | jq -rc '.sha')\n+        MSG=$(echo $recheck | jq -rc '.message_id')\n+        ./foo_ci_restart --pw-project=$PROJ --pw-instance=$INST \\\n+                         --series-id=$SERIES --sha=$SHA --token=$FOO_TOKEN\n+        ./recheck_tool --pw-project=$PROJ --pw-instance=$INST --msgid=$MSG \\\n+                       --series-id=$SERIES --filter=$FILTER \\\n+                       --update --state=0 --new-state=1\n+    done\n+\n+From the users' perspective, in order to request a retest on your patch\n+series, send an email reply to one of your series’s patch or cover letter\n+emails with email content of the format used below::\n+\n+  Recheck-request: <test names>\n+\n+The valid delimiter is a comma optionally followed by a space: “,” “, “\n+\n+Valid examples::\n+\n+  Recheck-request: foo, bar, baz\n+\n+  Recheck-request:   foo,bar,baz\n+\n+  Recheck-request: foo,bar,baz,\n+\n+Individual projects will have their own policies around who may request a\n+recheck, how many recheck requests may be sent, etc.  This should be\n+documented by the individual projects.\ndiff --git a/pw_mon b/pw_mon\nindex e1c1eab..bbe9837 100755\n--- a/pw_mon\n+++ b/pw_mon\n@@ -1,6 +1,6 @@\n #!/bin/sh\n # SPDX-Identifier: gpl-2.0-or-later\n-# Copyright (C) 2018, Red Hat, Inc.\n+# Copyright (C) 2018-2023 Red Hat, Inc.\n #\n # Monitors a project on a patchwork instance for new series submissions\n # Records the submissions in the series database (and emits them on the\n@@ -44,6 +44,7 @@ if [ \"$1\" != \"\" ]; then\n     fi\n fi\n \n+recheck_filter=\"\"\n \n while [ \"$1\" != \"\" ]; do\n     if echo \"$1\" | grep -q -s -E ^--pw-project= ; then\n@@ -64,8 +65,13 @@ while [ \"$1\" != \"\" ]; do\n         echo \"\"\n         echo \"Options:\"\n         echo \"    --pw-credentials=u:p\t\tSets user / password for web client\"\n+        echo \"    --add-filter-recheck=filter  Adds a filter to flag that a recheck needs to be done\"\n         echo \"\"\n         exit 0\n+    elif echo \"$1\" | grep -q -s -E ^--add-filter-recheck=; then\n+        filter_str=$(echo \"$1\" | sed s/--add-filter-recheck=//)\n+        recheck_filter=\"$filter_str $recheck_filter\"\n+        shift\n     else\n         echo \"Unknown option: '$1'\"\n         echo \"Rerun with --help for details\"\n@@ -190,7 +196,58 @@ function check_superseded_series() {\n     done\n }\n \n+function run_recheck() {\n+    local recheck_list=$(echo \"$7\" | sed -e 's/^Recheck-request: // ' -e 's/,/ /g')\n+\n+    for filter in $recheck_filter; do\n+        for check in $recheck_list; do\n+            if [ \"$filter\" == \"$check\" ]; then\n+                insert_recheck_request_if_needed \"$1\" \"$3\" \"$8\" \"$check\" \"$2\" \"$9\"\n+            fi\n+        done\n+    done\n+}\n+\n+function check_patch_for_retest_request() {\n+    local patch_url=\"$1\"\n+\n+    local patch_json=$(curl -s \"$userpw\" \"$patch_url\")\n+    local patch_comments_url=$(echo \"$patch_json\" | jq -rc '.comments')\n+    local patch_id=$(echo \"$patch_json\" | jq -rc '.id')\n+    if [ \"Xnull\" != \"X$patch_comments_url\" ]; then\n+        local comments_json=$(curl -s \"$userpw\" \"$patch_comments_url\")\n+\n+        local seq_end=$(echo \"$comments_json\" | jq -rc 'length')\n+        if [ \"$seq_end\" -a $seq_end -gt 0 ]; then\n+            seq_end=$((seq_end-1))\n+            for comment_id in $(seq 0 $seq_end); do\n+                local recheck_requested=$(echo \"$comments_json\" | jq -rc \".[$comment_id].content\" | grep \"^Recheck-request: \")\n+                if [ \"X$recheck_requested\" != \"X\" ]; then\n+                    local msgid=$(echo \"$comments_json\" | jq -rc \".[$comment_id].msgid\")\n+                    run_recheck \"$pw_instance\" \"$series_id\" \"$project\" \"$url\" \"$repo\" \"$branchname\" \"$recheck_requested\" \"$msgid\" \"$patch_id\"\n+                fi\n+            done\n+        fi\n+    fi\n+}\n+\n+function check_series_needs_retest() {\n+    local pw_instance=\"$1\"\n+\n+    series_get_active_branches \"$pw_instance\" | while IFS=\\| read -r series_id project url repo branchname; do\n+        local patch_comments_url=$(curl -s \"$userpw\" \"$url\" | jq -rc '.patches[] | .url')\n+\n+        for patch in $patch_comments_url; do\n+            check_patch_for_retest_request $patch\n+        done\n+    done\n+}\n+\n check_undownloaded_series \"$pw_instance\" \"$pw_project\"\n check_completed_series \"$pw_instance\" \"$pw_project\"\n check_new_series \"$pw_instance\" \"$pw_project\"\n check_superseded_series \"$pw_instance\"\n+\n+# check for retest requests after a series is still passing all the\n+# checks above\n+check_series_needs_retest \"$pw_instance\"\ndiff --git a/recheck_tool b/recheck_tool\nnew file mode 100755\nindex 0000000..98031a9\n--- /dev/null\n+++ b/recheck_tool\n@@ -0,0 +1,99 @@\n+#!/bin/sh\n+# SPDX-Identifier: gpl-2.0-or-later\n+# Copyright (C) 2023 Red Hat, Inc.\n+#\n+# Licensed under the terms of the GNU General Public License as published\n+# by the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.  You may obtain a copy of the\n+# license at\n+#\n+#    https://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+\n+mode=\"select\"\n+\n+while [ \"$1\" != \"\" ]; do\n+    if echo \"$1\" | grep -q -s -E ^--help ; then\n+        echo \"recheck / retest state machine script\"\n+        echo \"\"\n+        echo \"$0:\"\n+        echo \" --pw-project=<proj>:\tPatchwork project.\"\n+        echo \" --pw-instance=<inst>:\tPatchwork instance.\"\n+        echo \" --filter=<str>:\t\tJob / request for recheck.\"\n+        echo \" --state=<0..>:\t\tResync state ID.\"\n+        echo \" --msgid=<msgid>:\t\tMessage ID to select.\"\n+        echo \" --update:\t\tSet tool in update mode\"\n+        echo \" --new-state=<0..>:\tNew state ID to set\"\n+        echo \" --series-id=<..>:\tSeries ID\"\n+        echo \"\"\n+        echo \"Will spit out a parsable json for each db line when selecting\"\n+        exit 0\n+    elif echo \"$1\" | grep -q -s -E ^--pw-project= ; then\n+        pw_project=$(echo \"$1\" | sed s/^--pw-project=//)\n+    elif echo \"$1\" | grep -q -s -E ^--pw-instance= ; then\n+        pw_instance=$(echo \"$1\" | sed s/^--pw-instance=//)\n+    elif echo \"$1\" | grep -q -s -E ^--filter= ; then\n+        filter=$(echo \"$1\" | sed s/^--filter=//)\n+    elif echo \"$1\" | grep -q -s -E ^--state= ; then\n+        recheck_state=$(echo \"$1\" | sed s/^--state=//)\n+    elif echo \"$1\" | grep -q -s -E ^--msgid= ; then\n+        message_id=$(echo \"$1\" | sed s/^--msgid=//)\n+    elif echo \"$1\" | grep -q -s -E ^--update ; then\n+        mode=\"update\"\n+    elif echo \"$1\" | grep -q -s -E ^--new-state= ; then\n+        new_recheck_state=$(echo \"$1\" | sed s/^--new-state=//)\n+    elif echo \"$1\" | grep -q -s -E ^--series-id= ; then\n+        series_id=$(echo \"$1\" | sed s/^--series-id=//)\n+    else\n+        echo \"Unknown option: '$1'\"\n+        echo \"Rerun with --help for details\"\n+        exit 1\n+    fi\n+    shift\n+done\n+\n+source $(dirname $0)/series_db_lib.sh\n+\n+if [ \"$mode\" == \"select\" ]; then\n+    echo -n \"{\\\"rechecks\\\":[\"\n+    printed=\"\"\n+    for request in $(get_recheck_requests_by_project \"$pw_instance\" \\\n+                                                     \"$pw_project\" \\\n+                                                     \"$recheck_state\" \\\n+                                                     \"$filter\"); do\n+        message_id=$(echo $request | cut -d\\| -f1)\n+        series_id=$(echo $request | cut -d\\| -f2)\n+        patch_id=$(echo $request | cut -d\\| -f3)\n+\n+        sha=$(get_sha_for_series_id_and_patch \"$series_id\" \"$patch_id\" \\\n+                                              \"$pw_instance\")\n+        echo -n \"$printed{\\\"pw_instance\\\":\\\"$pw_instance\\\",\\\"series_id\\\":$series_id,\\\"patch_id\\\":$patch_id,\\\"sha\\\":\\\"$sha\\\",\\\"msg_id\\\":\\\"$message_id\\\",\\\"state\\\":\\\"$recheck_state\\\",\\\"requested\\\":\\\"$filter\\\"}\"\n+        printed=\",\"\n+    done\n+    echo \"]}\"\n+elif [ \"$mode\" == \"update\" ]; then\n+    if [ \"X$new_recheck_state\" == \"X\" -o \"X$series_id\" == \"X\" ]; then\n+        echo \"Need to set a series-id and a new recheck state when updating.\"\n+        exit 1\n+    fi\n+\n+    request=$(get_recheck_request \"$pw_instance\" \"$pw_project\" \"$message_id\" \\\n+                                  \"$filter\" \"$series_id\" \"$recheck_state\")\n+    if [ \"X$request\" == \"X\" ]; then\n+        echo \"{\\\"result\\\":\\\"notfound\\\"}\"\n+        exit 0\n+    fi\n+\n+    set_recheck_request_state \"$pw_instance\" \"$pw_project\" \"$message_id\" \\\n+                              \"$filter\" \"$series_id\" \"$new_recheck_state\"\n+\n+    echo \"{\\\"result\\\":\\\"executed\\\",\\\"recheck\\\":{\\\"pw_instance\\\": \\\"$pw_instance\\\", \\\"series_id\\\":$series_id, \\\"msg_id\\\":\\\"$message_id\\\", \\\"state\\\":\\\"$new_recheck_state\\\", \\\"requested\\\": \\\"$filter\\\"}}\"\n+else\n+    echo \"Uknown state: $mode\"\n+    exit 1\n+fi\ndiff --git a/series_db_lib.sh b/series_db_lib.sh\nindex 6c2d98e..e03a02e 100644\n--- a/series_db_lib.sh\n+++ b/series_db_lib.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n # SPDX-Identifier: gpl-2.0-or-later\n-# Copyright (C) 2018,2019 Red Hat, Inc.\n+# Copyright (C) 2018-2023 Red Hat, Inc.\n #\n # Licensed under the terms of the GNU General Public License as published\n # by the Free Software Foundation; either version 2 of the License, or\n@@ -114,6 +114,22 @@ EOF\n         run_db_command \"INSERT INTO series_schema_version(id) values (7);\"\n     fi\n \n+    run_db_command \"select * from series_schema_version;\" | egrep '^8$' > /dev/null 2>&1\n+    if [ $? -eq 1 ]; then\n+        sqlite3 ${HOME}/.series-db <<EOF\n+CREATE TABLE recheck_requests (\n+recheck_id INTEGER,\n+recheck_message_id STRING,\n+recheck_requested_by STRING,\n+recheck_series STRING,\n+recheck_patch INTEGER,\n+patchwork_instance STRING,\n+patchwork_project STRING,\n+recheck_sync INTEGER\n+);\n+EOF\n+        run_db_command \"INSERT INTO series_schema_version(id) values (8);\"\n+    fi\n }\n \n function series_db_exists() {\n@@ -390,3 +406,57 @@ function get_patch_id_by_series_id_and_sha() {\n \n     echo \"select patch_id from git_builds where patchwork_instance=\\\"$instance\\\" and series_id=$series_id and sha=\\\"$sha\\\";\" | series_db_execute\n }\n+\n+function get_sha_for_series_id_and_patch() {\n+    local series_id=\"$1\"\n+    local patch_id=\"$2\"\n+    local instance=\"$3\"\n+\n+    echo \"select sha from git_builds where patchwork_instance=\\\"$instance\\\" and series_id=\\\"$series_id\\\" and patch_id=\\\"$patch_id\\\"\" | series_db_execute\n+}\n+\n+function get_recheck_requests_by_project() {\n+    local recheck_instance=\"$1\"\n+    local recheck_project=\"$2\"\n+    local recheck_state=\"$3\"\n+    local recheck_requested_by=\"$4\"\n+\n+    series_db_exists\n+\n+    echo \"select recheck_message_id,recheck_series,recheck_patch from recheck_requests where patchwork_instance=\\\"$recheck_instance\\\" and patchwork_project=\\\"$recheck_project\\\" and recheck_sync=$recheck_state and recheck_requested_by=\\\"$recheck_requested_by\\\";\" | series_db_execute\n+}\n+\n+function insert_recheck_request_if_needed() {\n+    local recheck_instance=\"$1\"\n+    local recheck_project=\"$2\"\n+    local recheck_msgid=\"$3\"\n+    local recheck_requested_by=\"$4\"\n+    local recheck_series=\"$5\"\n+    local recheck_patch=\"$6\"\n+\n+    if ! echo \"select * from recheck_requests where recheck_message_id=\\\"$recheck_msgid\\\";\" | series_db_execute | grep $recheck_msgid >/dev/null 2>&1; then\n+        echo \"INSERT INTO recheck_requests (recheck_message_id, recheck_requested_by, recheck_series, recheck_patch, patchwork_instance, patchwork_project, recheck_sync) values (\\\"$recheck_msgid\\\", \\\"$recheck_requested_by\\\", \\\"$recheck_series\\\", $recheck_patch, \\\"$recheck_instance\\\", \\\"$recheck_project\\\", 0);\" | series_db_execute\n+    fi\n+}\n+\n+function get_recheck_request() {\n+    local recheck_instance=\"$1\"\n+    local recheck_project=\"$2\"\n+    local recheck_msgid=\"$3\"\n+    local recheck_requested_by=\"$4\"\n+    local recheck_series=\"$5\"\n+    local recheck_state=\"$6\"\n+\n+    echo \"select * from recheck_requests where patchwork_instance=\\\"$recheck_instance\\\" and patchwork_project=\\\"$recheck_project\\\" and recheck_requested_by=\\\"$recheck_requested_by\\\" and recheck_series=\\\"$recheck_series\\\" and recheck_message_id=\\\"$recheck_msgid\\\" and recheck_sync=$recheck_state;\" | series_db_execute\n+}\n+\n+function set_recheck_request_state() {\n+    local recheck_instance=\"$1\"\n+    local recheck_project=\"$2\"\n+    local recheck_msgid=\"$3\"\n+    local recheck_requested_by=\"$4\"\n+    local recheck_series=\"$5\"\n+    local recheck_state=\"$6\"\n+\n+    echo \"UPDATE recheck_requests set recheck_sync=$recheck_state where patchwork_instance=\\\"$recheck_instance\\\" and patchwork_project=\\\"$recheck_project\\\" and recheck_requested_by=\\\"$recheck_requested_by\\\" and recheck_series=\\\"$recheck_series\\\";\" | series_db_execute\n+}\n",
    "prefixes": [
        "v3",
        "2/3"
    ]
}