From f567e82801f66b3a71604b088bbaaca6081e6b29 Mon Sep 17 00:00:00 2001 From: mbohlool Date: Thu, 20 Apr 2017 13:48:08 -0700 Subject: [PATCH] Update (and generalize) cherry pick script for client-python --- scripts/cherry_pick_pull.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/cherry_pick_pull.sh b/scripts/cherry_pick_pull.sh index 43401da9c..1d8024f0f 100755 --- a/scripts/cherry_pick_pull.sh +++ b/scripts/cherry_pick_pull.sh @@ -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= (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:"