aboutsummaryrefslogtreecommitdiff
path: root/get-mainline-feature
diff options
context:
space:
mode:
Diffstat (limited to 'get-mainline-feature')
-rwxr-xr-xget-mainline-feature50
1 files changed, 50 insertions, 0 deletions
diff --git a/get-mainline-feature b/get-mainline-feature
new file mode 100755
index 0000000..c8ffd72
--- /dev/null
+++ b/get-mainline-feature
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0
+# (c) 2020,2022, Mathieu Poirier <mathieu.poirier@linaro.org>
+#
+# Find all the commits that:
+# 1) Have a title that doesn't include any of the words in the dictionary
+# 2) Have not been back ported to any of the stable trees
+#
+# USAGE:
+# $ git log --no-merges --no-renames --format="%H" v5.6..v5.7 | parallel --link get-mainline-feature :::: - ::: stable.file ::: output.file
+# $ cat data.txt | parallel --link get-mainline-feature :::: - ::: stable.file ::: output.file
+#
+# INPUT:
+# $1: A git generated SHA1, i.e "bcf876870b95592b52519ed4aafcf9d95999bc9c"
+# $2: Output file from the command "positive-set"
+# $3: Name of the output file
+#
+
+dictionary=(MAINTAINER tag defconfig dts selftest script doc
+ bindings kbuild kconfig coccinelle mailmap checkpatch)
+
+# Needed if input is coming from a file
+sha1=$(echo $1 | awk {'print $1'})
+
+subj=$(git log -1 --pretty="%s" $sha1)
+if [ $? -gt 0 ]; then
+ exit 1
+fi
+
+# No point in going further if the commit is a tag
+git describe --exact-match $sha1 &> /dev/null
+if [ $? -eq 0 ]; then
+ exit 0
+fi
+
+# Skip patches with a title that includes one of the words in the dictionary
+for token in "${dictionary[@]}"; do
+ if [ "$(echo $subj | grep -i $token | wc -l)" -ne 0 ]; then
+ exit 0
+ fi
+done
+
+# See if $sha is part of the stable set in $2
+if [ "$(grep $sha1 $2 | wc -l)" -eq 0 ]; then
+ # This patch looks like a feature, add it to the log
+ echo "$sha1 $subj" >> $3
+fi
+
+exit 0