feat(vim-patch.sh): support additional args for -s

This allows creating a draft vim-patch PR.
This commit is contained in:
zeertzjq
2022-03-05 10:11:31 +08:00
parent 83fc914337
commit 0ec92bb463

View File

@@ -36,7 +36,7 @@ usage() {
echo " can be a Vim version (8.0.xxx) or a Git hash." echo " can be a Vim version (8.0.xxx) or a Git hash."
echo " -P {vim-revision} Download, generate and apply a Vim patch." echo " -P {vim-revision} Download, generate and apply a Vim patch."
echo " -g {vim-revision} Download a Vim patch." echo " -g {vim-revision} Download a Vim patch."
echo " -s Create a vim-patch pull request." echo " -s [pr args] Create a vim-patch pull request."
echo " -r {pr-number} Review a vim-patch pull request." echo " -r {pr-number} Review a vim-patch pull request."
echo " -V Clone the Vim source code to \$VIM_SOURCE_DIR." echo " -V Clone the Vim source code to \$VIM_SOURCE_DIR."
echo echo
@@ -329,7 +329,8 @@ stage_patch() {
printf '\nInstructions:\n Proceed to port the patch.\n Try the "patch" command (or use "%s -P ..." next time):\n patch -p1 < %s\n' "${BASENAME}" "${patch_file}" printf '\nInstructions:\n Proceed to port the patch.\n Try the "patch" command (or use "%s -P ..." next time):\n patch -p1 < %s\n' "${BASENAME}" "${patch_file}"
fi fi
printf ' printf '
Stage your changes ("git add ..."), then use "git commit --amend" to commit.
To port more patches (if any) related to %s, To port more patches (if any) related to %s,
run "%s" again. run "%s" again.
@@ -338,13 +339,19 @@ stage_patch() {
When you are done, try "%s -s" to create the pull request, When you are done, try "%s -s" to create the pull request,
or "%s -s --draft" to create a draft pull request. or "%s -s --draft" to create a draft pull request.
See the wiki for more information:
* https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim
' "${vim_version}" "${BASENAME}" "${BASENAME}"
return $ret
}
gh_pr() { gh_pr() {
local pr_title local pr_title
local pr_body local pr_body
pr_title="$1" pr_title="$1"
pr_body="$2"
shift 2
gh pr create --title "${pr_title}" --body "${pr_body}" "$@" gh pr create --title "${pr_title}" --body "${pr_body}" "$@"
} }
@@ -408,7 +415,7 @@ submit_pr() {
if output="$(git push "$push_remote" "$checked_out_branch" 2>&1)"; then if output="$(git push "$push_remote" "$checked_out_branch" 2>&1)"; then
msg_ok "$output" msg_ok "$output"
else else
msg_err "$output" msg_err "$output"
exit 1 exit 1
fi fi
@@ -799,7 +806,8 @@ while getopts "hlLmMVp:P:g:r:s" opt; do
exit 0 exit 0
;; ;;
g) g)
get_vimpatch "${OPTARG}" get_vimpatch "${OPTARG}"
exit 0
;; ;;
r) r)
review_pr "${OPTARG}" review_pr "${OPTARG}"