Skip to content

Commit f567e82

Browse files
committed
Update (and generalize) cherry pick script for client-python
1 parent 7408d90 commit f567e82

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

scripts/cherry_pick_pull.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ set -o errexit
2323
set -o nounset
2424
set -o pipefail
2525

26-
declare -r KUBE_ROOT="$(dirname "${BASH_SOURCE}")/.."
27-
cd "${KUBE_ROOT}"
26+
declare -r REPO_ROOT="$(git rev-parse --show-toplevel)"
27+
cd "${REPO_ROOT}"
2828

2929
declare -r STARTINGBRANCH=$(git symbolic-ref --short HEAD)
30-
declare -r REBASEMAGIC="${KUBE_ROOT}/.git/rebase-apply"
30+
declare -r REBASEMAGIC="${REPO_ROOT}/.git/rebase-apply"
3131
DRY_RUN=${DRY_RUN:-""}
3232
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
3333
FORK_REMOTE=${FORK_REMOTE:-origin}
34+
MAIN_REPO_NAME=${MAIN_REPO_NAME:-"client-python"}
35+
MAIN_REPO_ORG=${MAIN_REPO_ORG:-"kubernetes-incubator"}
3436

3537
if [[ -z ${GITHUB_USER:-} ]]; then
3638
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}.
135137
$(printf '%s\n' "${SUBJECTS[@]}")
136138
EOF
137139

138-
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "kubernetes:${rel}"
140+
hub pull-request -F "${prtext}" -h "${GITHUB_USER}:${NEWBRANCH}" -b "${MAIN_REPO_ORG}:${rel}"
139141
}
140142

141143
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
@@ -144,7 +146,8 @@ cleanbranch="${NEWBRANCHUNIQ}"
144146
gitamcleanup=true
145147
for pull in "${PULLS[@]}"; do
146148
echo "+++ Downloading patch to /tmp/${pull}.patch (in case you need to do this again)"
147-
curl -o "/tmp/${pull}.patch" -sSL "http://pr.k8s.io/${pull}.patch"
149+
150+
curl -o "/tmp/${pull}.patch" -sSL "https://github.com/${MAIN_REPO_ORG}/${MAIN_REPO_NAME}/pull/${pull}.patch"
148151
echo
149152
echo "+++ About to attempt cherry pick of PR. To reattempt:"
150153
echo " $ git am -3 /tmp/${pull}.patch"
@@ -195,8 +198,8 @@ if [[ -n "${DRY_RUN}" ]]; then
195198
exit 0
196199
fi
197200

198-
if git remote -v | grep ^${FORK_REMOTE} | grep kubernetes/kubernetes.git; then
199-
echo "!!! You have ${FORK_REMOTE} configured as your kubernetes/kubernetes.git"
201+
if git remote -v | grep ^${FORK_REMOTE} | grep {$MAIN_REPO_ORG}/{$MAIN_REPO_NAME}.git; then
202+
echo "!!! You have ${FORK_REMOTE} configured as your {$MAIN_REPO_ORG}/{$MAIN_REPO_NAME}.git"
200203
echo "This isn't normal. Leaving you with push instructions:"
201204
echo
202205
echo "+++ First manually push the branch this script created:"

0 commit comments

Comments
 (0)