vim-patch: Add -g switch to download/preprocess patch

This commit is contained in:
James McCoy
2016-12-12 20:48:55 -05:00
parent 988ab5804a
commit c6bd9f525c

View File

@@ -25,6 +25,9 @@ usage() {
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 " -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."
echo " -s Submit a vim-patch pull request to Neovim."
echo " -r {pr-number} Review a vim-patch pull request to Neovim."
echo
@@ -166,9 +169,21 @@ get_vim_patch() {
>&2 echo "✘ Couldn't find Vim revision '${vim_commit}'."
exit 3
}
echo "✔ Found Vim revision '${vim_commit}'."
echo "✔ Found Vim revision '${vim_commit}'."
local patch_content
patch_content="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}")"
cd "${NVIM_SOURCE_DIR}"
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"
preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}"
printf "✔ Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n"
}
stage_patch() {
get_vim_patch "$1"
@@ -183,6 +198,7 @@ get_vim_patch() {
echo " branch; not creating a new branch."
else
printf "\nFetching '${git_remote}/master'.\n"
output="$(git fetch "${git_remote}" master 2>&1)" &&
echo "${output}" ||
(echo "${output}"; false)
@@ -196,14 +212,6 @@ get_vim_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)
printf "Creating patch...\n"
echo "$patch_content" > "${NVIM_SOURCE_DIR}/${patch_file}"
printf "Pre-processing patch...\n"
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
echo "${output}" ||
(echo "${output}"; false)
@@ -218,8 +226,7 @@ get_vim_patch() {
current branch, call '${BASENAME} -p' again.
* Do this only for _related_ patches (otherwise it increases the
size of the pull request, making it harder to review)
When you're done, try '${BASENAME} -s' to create the pull request.
When you're done, try '${BASENAME} -s' to create the pull request.
See the wiki for more information:
@@ -430,7 +437,7 @@ review_pr() {
fi
fi
done
clean_files
}
@@ -441,6 +448,10 @@ while getopts "hlp:r:s" opt; do
exit 0
;;
l)
list_vim_patches
exit 0
;;
p)
stage_patch "${OPTARG}"
exit 0
;;