Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ecb1a731
Unverified
Commit
ecb1a731
authored
Oct 09, 2018
by
Davanum Srinivas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cherry_pick_pull should work for non-k/k repos
Change-Id: If13277d082dd6febadd58f78b7b5710c4fcb2988
parent
5d0c19c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
cherry_pick_pull.sh
hack/cherry_pick_pull.sh
+14
-9
No files found.
hack/cherry_pick_pull.sh
View file @
ecb1a731
...
...
@@ -16,22 +16,26 @@
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
# meta.) Assumes you care about pulls from remote "upstream" and
# checks them
s
out to a branch named:
# checks them out to a branch named:
# automated-cherry-pick-of-<pr>-<target branch>-<timestamp>
set
-o
errexit
set
-o
nounset
set
-o
pipefail
declare
-r
KUBE_ROOT
=
"
$(
dirname
"
${
BASH_SOURCE
}
"
)
/.."
cd
"
${
KUBE_ROOT
}
"
REPO_ROOT
=
"
$(
git rev-parse
--show-toplevel
)
"
declare
-r
REPO_ROOT
cd
"
${
REPO_ROOT
}
"
declare
-r
STARTINGBRANCH
=
$(
git symbolic-ref
--short
HEAD
)
declare
-r
REBASEMAGIC
=
"
${
KUBE_ROOT
}
/.git/rebase-apply"
STARTINGBRANCH
=
$(
git symbolic-ref
--short
HEAD
)
declare
-r
STARTINGBRANCH
declare
-r
REBASEMAGIC
=
"
${
REPO_ROOT
}
/.git/rebase-apply"
DRY_RUN
=
${
DRY_RUN
:-
""
}
REGENERATE_DOCS
=
${
REGENERATE_DOCS
:-
""
}
UPSTREAM_REMOTE
=
${
UPSTREAM_REMOTE
:-
upstream
}
FORK_REMOTE
=
${
FORK_REMOTE
:-
origin
}
MAIN_REPO_ORG
=
${
MAIN_REPO_ORG
:-$(
git remote get-url
"
$UPSTREAM_REMOTE
"
|
awk
-F
'[@:./]'
'NR==1{print $4}'
)}
MAIN_REPO_NAME
=
${
MAIN_REPO_NAME
:-$(
git remote get-url
"
$UPSTREAM_REMOTE
"
|
awk
-F
'[@:./]'
'NR==1{print $5}'
)}
if
[[
-z
${
GITHUB_USER
:-}
]]
;
then
echo
"Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
...
...
@@ -140,7 +144,7 @@ Cherry pick of ${PULLSUBJ} on ${rel}.
${
numandtitle
}
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
}
"
...
...
@@ -149,7 +153,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"
...
...
@@ -211,8 +216,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:"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment