summaryrefslogtreecommitdiff
path: root/script/backport.sh
diff options
context:
space:
mode:
Diffstat (limited to 'script/backport.sh')
-rwxr-xr-xscript/backport.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/script/backport.sh b/script/backport.sh
new file mode 100755
index 000000000..3c2f899d6
--- /dev/null
+++ b/script/backport.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+if test $# -eq 0
+then
+ echo "USAGE: $0 <#PR> [<#PR>...]"
+ exit
+fi
+
+commits=
+
+for pr in $*
+do
+ mergecommit=$(git rev-parse ":/Merge pull request #$pr" || exit 1)
+ mergebase=$(git merge-base "$mergecommit"^1 "$mergecommit"^2 || exit 1)
+
+ commits="$commits $(git rev-list --reverse "$mergecommit"^2 ^"$mergebase")"
+done
+
+echo "Cherry-picking the following commits:"
+git rev-list --no-walk --oneline $commits
+echo
+
+git cherry-pick $commits