summaryrefslogtreecommitdiffstats
path: root/debian/git-cherry-pick
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 13:00:48 +0000
commitf542925b701989ba6eed7b08b5226d4021b9b85f (patch)
tree57e14731f21a6d663326d30b7b88736e9d51c420 /debian/git-cherry-pick
parentAdding upstream version 247.3. (diff)
downloadsystemd-f542925b701989ba6eed7b08b5226d4021b9b85f.tar.xz
systemd-f542925b701989ba6eed7b08b5226d4021b9b85f.zip
Adding debian version 247.3-7+deb11u4.debian/247.3-7+deb11u4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/git-cherry-pick')
-rwxr-xr-xdebian/git-cherry-pick53
1 files changed, 53 insertions, 0 deletions
diff --git a/debian/git-cherry-pick b/debian/git-cherry-pick
new file mode 100755
index 0000000..1fabd32
--- /dev/null
+++ b/debian/git-cherry-pick
@@ -0,0 +1,53 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$*" ] ; then
+ echo "Usage: $0 [commit [commit ..]]"
+ exit 1
+fi
+
+
+curbranch=$(git rev-parse --abbrev-ref HEAD)
+
+# assert we got a branch
+[ -n "$curbranch" ]
+
+if [ $curbranch = HEAD ] ; then
+ echo "You are not currently on a branch, cannot cherry-pick"
+ exit 1
+fi
+
+case $curbranch in
+ patch-queue/*)
+ debbranch=${curbranch/patch-queue\/}
+ pqbranch=$curbranch
+ ;;
+ *)
+ debbranch=$curbranch
+ pqbranch=patch-queue/$curbranch
+ ;;
+esac
+
+commits=$(git rev-parse "$@")
+
+if git rev-parse $pqbranch &>/dev/null ; then
+ echo
+ echo "Will recreate patch-queue branch $pqbranch"
+ echo "It was pointing to" $(git rev-parse $pqbranch)
+ echo
+fi
+
+gbp pq import --force
+
+echo "Cherry-picking the following commits:"
+echo "$commits"
+
+picks=$(echo "$commits" | xargs echo exec git cherry-pick -x --no-edit --commit)
+
+# find the first debian commit
+firstdebian=$(git log -i --grep "topic.*debian" --pretty=%h --reverse $debbranch..$pqbranch | head -1)
+
+sedexpr="/$firstdebian/i$picks"
+
+GIT_EDITOR="sed -i -e '$sedexpr'" git rebase --interactive --no-autosquash $debbranch