Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tools: Add a tool for backporting PRs.
Tim Abbottef3f99032464
diff --git a/tools/backport-pull-request b/tools/backport-pull-requestnew file mode 100755index 00000000000..73aee49b1f1--- /dev/null+++ b/tools/backport-pull-request@@ -0,0 +1,35 @@+#!/usr/bin/env bash+set -e++usage() {+ cat >&2 <<EOF+usage: $0 PULL_REQUEST_ID COMMIT_COUNT [REMOTE]++Fetch the given GitHub pull request branch and backport it to+the current branch using 'git cherry-pick -x'.++Typical usage is:+ git fetch upstream+ git checkout -b 8.x upstream/8.x+ $0 FIRST_PR_ID FIRST_PR_COMMIT_COUNT+ $0 SECOND_PR_ID SECOND_PR_COMMIT_COUNT+ git push origin +HEAD:backport-changes+EOF+ exit 1+}++remote_default="$(git config zulip.zulipRemote || echo upstream)"++request_id="$1"+commit_count="$2"++if [ -z "$request_id" ] || [ -z "$commit_count" ]; then+ usage+fi++remote=${3:-"$remote_default"}++set -x++git fetch "$remote" "pull/$request_id/head"+git cherry-pick -x FETCH_HEAD~"$commit_count"..FETCH_HEAD