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
954e6790
Unverified
Commit
954e6790
authored
Oct 17, 2016
by
Jess Frazelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hack/: update cherry-pick script to have settings to override remote names
Signed-off-by:
Jess Frazelle
<
acidburn@google.com
>
parent
c301ac9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
cherry_pick_pull.sh
hack/cherry_pick_pull.sh
+14
-8
No files found.
hack/cherry_pick_pull.sh
View file @
954e6790
...
...
@@ -29,6 +29,8 @@ cd "${KUBE_ROOT}"
declare
-r
STARTINGBRANCH
=
$(
git symbolic-ref
--short
HEAD
)
declare
-r
REBASEMAGIC
=
"
${
KUBE_ROOT
}
/.git/rebase-apply"
DRY_RUN
=
${
DRY_RUN
:-
""
}
UPSTREAM_REMOTE
=
${
UPSTREAM_REMOTE
:-
upstream
}
FORK_REMOTE
=
${
FORK_REMOTE
:-
origin
}
if
[[
-z
${
GITHUB_USER
:-}
]]
;
then
echo
"Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
...
...
@@ -51,6 +53,9 @@ if [[ "$#" -lt 2 ]]; then
echo
" Set the DRY_RUN environment var to skip git push and creating PR."
echo
" This is useful for creating patches to a release branch without making a PR."
echo
" When DRY_RUN is set the script will leave you in a branch containing the commits you cherry-picked."
echo
echo
" Set UPSTREAM_REMOTE (default: upstream) and FORK_REMOTE (default: origin)"
echo
" To override the default remote names to what you have locally."
exit
2
fi
...
...
@@ -73,10 +78,10 @@ declare -r PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#123
declare
-r
PULLSUBJ
=
$(
join
" "
"
${
PULLS
[@]/#/#
}
"
)
# Generates something like "#12345 #56789"
echo
"+++ Updating remotes..."
git remote update
upstream origin
git remote update
"
${
UPSTREAM_REMOTE
}
"
"
${
FORK_REMOTE
}
"
if
!
git log
-n1
--format
=
%H
"
${
BRANCH
}
"
>
/dev/null 2>&1
;
then
echo
"!!! '
${
BRANCH
}
' not found. The second argument should be something like
upstream
/release-0.21."
echo
"!!! '
${
BRANCH
}
' not found. The second argument should be something like
${
UPSTREAM_REMOTE
}
/release-0.21."
echo
" (In particular, it needs to be a valid, existing remote branch that I can 'git checkout'.)"
exit
1
fi
...
...
@@ -186,15 +191,16 @@ if [[ -n "${DRY_RUN}" ]]; then
exit
0
fi
if
git remote
-v
|
grep
^
origin
|
grep
kubernetes/kubernetes.git
;
then
echo
"!!! You have
'origin'
configured as your kubernetes/kubernetes.git"
if
git remote
-v
|
grep
^
${
FORK_REMOTE
}
|
grep
kubernetes/kubernetes.git
;
then
echo
"!!! You have
${
FORK_REMOTE
}
configured as your kubernetes/kubernetes.git"
echo
"This isn't normal. Leaving you with push instructions:"
echo
echo
"+++ First manually push the branch this script created:"
echo
echo
" git push REMOTE
${
NEWBRANCHUNIQ
}
:
${
NEWBRANCH
}
"
echo
echo
"where REMOTE is your personal fork (maybe 'upstream'? Consider swapping those.)."
echo
"where REMOTE is your personal fork (maybe
${
UPSTREAM_REMOTE
}
? Consider swapping those.)."
echo
"OR consider setting UPSTREAM_REMOTE and FORK_REMOTE to different values."
echo
make-a-pr
cleanbranch
=
""
...
...
@@ -202,9 +208,9 @@ if git remote -v | grep ^origin | grep kubernetes/kubernetes.git; then
fi
echo
echo
"+++ I'm about to do the following to push to GitHub (and I'm assuming
origin
is your personal fork):"
echo
"+++ I'm about to do the following to push to GitHub (and I'm assuming
${
FORK_REMOTE
}
is your personal fork):"
echo
echo
" git push
origin
${
NEWBRANCHUNIQ
}
:
${
NEWBRANCH
}
"
echo
" git push
${
FORK_REMOTE
}
${
NEWBRANCHUNIQ
}
:
${
NEWBRANCH
}
"
echo
read
-p
"+++ Proceed (anything but 'y' aborts the cherry-pick)? [y/n] "
-r
if
!
[[
"
${
REPLY
}
"
=
~ ^[yY]
$
]]
;
then
...
...
@@ -212,5 +218,5 @@ if ! [[ "${REPLY}" =~ ^[yY]$ ]]; then
exit
1
fi
git push
origin
-f
"
${
NEWBRANCHUNIQ
}
:
${
NEWBRANCH
}
"
git push
"
${
FORK_REMOTE
}
"
-f
"
${
NEWBRANCHUNIQ
}
:
${
NEWBRANCH
}
"
make-a-pr
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