mirror of
https://github.com/neovim/neovim.git
synced 2026-01-05 02:47:28 +10:00
vim-patch.sh: new option -P
This commit is contained in:
@@ -22,9 +22,10 @@ usage() {
|
||||
echo "Options:"
|
||||
echo " -h Show this message and exit."
|
||||
echo " -l Show list of Vim patches missing from Neovim."
|
||||
echo " -p {vim-revision} Download and apply the Vim patch vim-revision."
|
||||
echo " vim-revision can be a version number of the "
|
||||
echo " format '7.4.xxx' or a Git commit hash."
|
||||
echo " -p {vim-revision} Download and generate the specified Vim patch."
|
||||
echo " vim-revision can be a version number '8.0.xxx'"
|
||||
echo " or a valid Git ref (hash, tag, etc.)."
|
||||
echo " -P {vim-revision} Download, generate and apply the Vim patch."
|
||||
echo " -g {vim-revision} Download the Vim patch vim-revision."
|
||||
echo " vim-revision can be a version number of the "
|
||||
echo " format '7.4.xxx' or a Git commit hash."
|
||||
@@ -32,7 +33,7 @@ usage() {
|
||||
echo " -r {pr-number} Review a vim-patch pull request to Neovim."
|
||||
echo
|
||||
echo "Set VIM_SOURCE_DIR to change where Vim's sources are stored."
|
||||
echo "The default is '${VIM_SOURCE_DIR_DEFAULT}'."
|
||||
echo "Default is '${VIM_SOURCE_DIR_DEFAULT}'."
|
||||
}
|
||||
|
||||
# Checks if a program is in the user's PATH, and is executable.
|
||||
@@ -186,6 +187,7 @@ get_vim_patch() {
|
||||
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
|
||||
|
||||
printf "✔ Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n"
|
||||
}
|
||||
|
||||
stage_patch() {
|
||||
get_vim_patch "$1"
|
||||
@@ -215,14 +217,23 @@ stage_patch() {
|
||||
fi
|
||||
|
||||
printf "\nCreating empty commit with correct commit message.\n"
|
||||
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
|
||||
echo "✔ ${output}" ||
|
||||
(echo "✘ ${output}"; false)
|
||||
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
|
||||
echo "✔ ${output}" ||
|
||||
(echo "✘ ${output}"; false)
|
||||
|
||||
if test -n "$try_apply" ; then
|
||||
if ! check_executable patch; then
|
||||
printf "\n✘ 'patch' command not found\n"
|
||||
else
|
||||
printf "\nApplying patch...\n"
|
||||
patch -p1 < "${patch_file}"
|
||||
fi
|
||||
printf "\nInstructions:\n Proceed to port the patch.\n"
|
||||
printf "\nInstructions:
|
||||
else
|
||||
printf "\nInstructions:\n Proceed to port the patch.\n Try the 'patch' command (or use '${BASENAME} -P ...' next time):\n patch -p1 < ${patch_file}\n"
|
||||
fi
|
||||
patch -p1 < ${patch_file}
|
||||
|
||||
|
||||
printf "
|
||||
Stage your changes ('git add ...'), then use 'git commit --amend' to commit.
|
||||
|
||||
To port more patches (if any) related to ${vim_version},
|
||||
@@ -446,7 +457,7 @@ review_pr() {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
clean_files
|
||||
}
|
||||
|
||||
@@ -460,6 +471,10 @@ while getopts "hlp:g:r:s" opt; do
|
||||
list_vim_patches
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
stage_patch "${OPTARG}"
|
||||
exit 0
|
||||
;;
|
||||
P)
|
||||
stage_patch "${OPTARG}" TRY_APPLY
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user