summaryrefslogtreecommitdiffstats
path: root/scripts/mk-patch-list.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:11:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:11:10 +0000
commitcff6d757e3ba609c08ef2aaa00f07e53551e5bf6 (patch)
tree08c4fc3255483ad397d712edb4214ded49149fd9 /scripts/mk-patch-list.sh
parentAdding upstream version 2.9.7. (diff)
downloadhaproxy-cff6d757e3ba609c08ef2aaa00f07e53551e5bf6.tar.xz
haproxy-cff6d757e3ba609c08ef2aaa00f07e53551e5bf6.zip
Adding upstream version 3.0.0.upstream/3.0.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mk-patch-list.sh')
-rwxr-xr-xscripts/mk-patch-list.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/scripts/mk-patch-list.sh b/scripts/mk-patch-list.sh
new file mode 100755
index 0000000..aa6aa6d
--- /dev/null
+++ b/scripts/mk-patch-list.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+die() {
+ [ "$#" -eq 0 ] || echo "$*" >&2
+ exit 1
+}
+
+err() {
+ echo "$*" >&2
+}
+
+quit() {
+ [ "$#" -eq 0 ] || echo "$*"
+ exit 0
+}
+
+#### Main
+
+USAGE="Usage: ${0##*/} [-o <output_dir>] [-s <start_num>] [-b <base>] commit_id..."
+OUTPUT=
+BASE=
+NUM=
+
+while [ -n "$1" -a -z "${1##-*}" ]; do
+ case "$1" in
+ -b) BASE="$2" ; shift 2 ;;
+ -o) OUTPUT="$2" ; shift 2 ;;
+ -s) NUM="$2" ; shift 2 ;;
+ -h|--help) quit "$USAGE" ;;
+ *) die "$USAGE" ;;
+ esac
+done
+
+PATCHES=( "$@" )
+NUM=${NUM:-1}
+
+for p in ${PATCHES[@]}; do
+ if [ -n "$BASE" ]; then
+ # find the patch number from the base.
+ # E.g. v2.9-dev0-774-gd710dfbac
+ NUM=$(git describe --match "$BASE" "$p")
+ NUM=${NUM#"$BASE"-}
+ NUM=${NUM%-*}
+ fi
+ git format-patch -k -1 --start-number=$NUM ${OUTPUT:+-o $OUTPUT} "$p"
+ ((NUM++))
+done