Update (and generalize) cherry pick script for client-python

This commit is contained in:
mbohlool 2017-04-20 13:48:08 -07:00
parent 7408d902fc
commit f567e82801

View File

@ -23,14 +23,16 @@ set -o errexit
set -o nounset
set -o pipefail
declare -r KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
cd "${KUBE_ROOT}"
declare -r REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "${REPO_ROOT}"
declare -r STARTINGBRANCH=$(git symbolic-ref --short HEAD)
declare -r REBASEMAGIC="${KUBE_ROOT}/.git/rebase-apply"
declare -r REBASEMAGIC="${REPO_ROOT}/.git/rebase-apply"
DRY_RUN=${DRY_RUN:-""}
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
FORK_REMOTE=${FORK_REMOTE:-origin}
MAIN_REPO_NAME=${MAIN_REPO_NAME:-"client-python"}
MAIN_REPO_ORG=${MAIN_REPO_ORG:-"kubernetes-incubator"}
if [[ -z ${GITHUB_USER:-} ]]; then
echo "Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
@ -135,7 +137,7 @@ Cherry pick of ${PULLSUBJ} on ${rel}.
$(printf '%s\n' "${SUBJECTS[@]}")
EOF
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "kubernetes:${rel}"
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "${MAIN_REPO_ORG}:${rel}"
}
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
@ -144,7 +146,8 @@ cleanbranch="${NEWBRANCHUNIQ}"
gitamcleanup=true
for pull in "${PULLS[@]}"; do
echo "+++ Downloading patch to /tmp/${pull}.patch (in case you need to do this again)"
curl -o "/tmp/${pull}.patch" -sSL "http://pr.k8s.io/${pull}.patch"
curl -o "/tmp/${pull}.patch" -sSL "https://github.com/${MAIN_REPO_ORG}/${MAIN_REPO_NAME}/pull/${pull}.patch"
echo
echo "+++ About to attempt cherry pick of PR. To reattempt:"
echo " $ git am -3 /tmp/${pull}.patch"
@ -195,8 +198,8 @@ if [[ -n "${DRY_RUN}" ]]; then
exit 0
fi
if git remote -v | grep ^${FORK_REMOTE} | grep kubernetes/kubernetes.git; then
echo "!!! You have ${FORK_REMOTE} configured as your kubernetes/kubernetes.git"
if git remote -v | grep ^${FORK_REMOTE} | grep {$MAIN_REPO_ORG}/{$MAIN_REPO_NAME}.git; then
echo "!!! You have ${FORK_REMOTE} configured as your {$MAIN_REPO_ORG}/{$MAIN_REPO_NAME}.git"
echo "This isn't normal. Leaving you with push instructions:"
echo
echo "+++ First manually push the branch this script created:"