summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorMartin Roth <gaumless@gmail.com>2023-08-21 14:57:07 -0600
committerFelix Held <felix-coreboot@felixheld.de>2023-08-23 12:09:08 +0000
commit11bd917ca4d0fc28da07eaebdbf7f52c30236f89 (patch)
tree33828f1f58cd285a1dfd6900cd5d6249a75c5d25 /util
parent02295db726c5dc007736b60bd978c8bcef58f5c8 (diff)
util/release: Upload script to abandon patches older than 1 year
This script allows any user with abandon rights to abandon patches that haven't been touched (reviewed, commented on, rebased, etc) in over a year. As a part of the release process, we're now going to run the script to abandon all of those patches so that we don't get to the point of needing to abandon 1300 patches again in the future. Signed-off-by: Martin Roth <gaumless@gmail.com> Change-Id: I4a07c09edf02d9c1858a58322095eefbceb529d3 Reviewed-on: https://review.coreboot.org/c/coreboot/+/77365 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Diffstat (limited to 'util')
-rwxr-xr-xutil/release/abandon_untouched_patches36
1 files changed, 36 insertions, 0 deletions
diff --git a/util/release/abandon_untouched_patches b/util/release/abandon_untouched_patches
new file mode 100755
index 0000000000..46fad76fa2
--- /dev/null
+++ b/util/release/abandon_untouched_patches
@@ -0,0 +1,36 @@
+#!/usr/bin/bash
+
+GERRIT_USER=$1
+
+QUERY_AGE="age:1year"
+MESSAGE_AGE="a year"
+
+if [[ -z "${GERRIT_USER}" || "${GERRIT_USER}" = "-h" || "${GERRIT_USER}" = "--help" ]]; then
+ echo "Usage: $0 <Gerrit username>"
+ exit 0
+fi
+
+if ! command -v jq >/dev/null 2>&1; then
+ echo "Error. Please install the package 'jq' before continuing."
+ exit 1
+fi
+
+gerrit_cmd() {
+ ssh -p 29418 "${GERRIT_USER}@review.coreboot.org" gerrit "$@"
+}
+
+abandon_patch() {
+ local patch=$1
+ message="\'\"This patch has not been touched in over ${MESSAGE_AGE}. Anyone who wants to take over work on this patch, please feel free to restore it and do any work needed to get it merged. If you create a new patch based on this work, please credit the original author.\"\'"
+
+ echo "Abandoning ${patch}"
+ gerrit_cmd review --project coreboot --abandon --message "${message}" "${patch}"
+}
+
+get_patchlist() {
+ gerrit_cmd query --format=JSON --no-limit --current-patch-set "repo:coreboot AND status:open AND ${QUERY_AGE}" | \
+ jq -Mr '.currentPatchSet.revision' | \
+ grep -v null
+}
+
+for patch in $(get_patchlist); do abandon_patch "${patch}"; done