mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
vim-patch: Add -g switch to download/preprocess patch
This commit is contained in:
@@ -25,6 +25,9 @@ usage() {
|
|||||||
echo " -p {vim-revision} Download and apply the Vim patch vim-revision."
|
echo " -p {vim-revision} Download and apply the Vim patch vim-revision."
|
||||||
echo " vim-revision can be a version number of the "
|
echo " vim-revision can be a version number of the "
|
||||||
echo " format '7.4.xxx' or a Git commit hash."
|
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 " -s Submit a vim-patch pull request to Neovim."
|
||||||
echo " -r {pr-number} Review a vim-patch pull request to Neovim."
|
echo " -r {pr-number} Review a vim-patch pull request to Neovim."
|
||||||
echo
|
echo
|
||||||
@@ -166,9 +169,21 @@ get_vim_patch() {
|
|||||||
>&2 echo "✘ Couldn't find Vim revision '${vim_commit}'."
|
>&2 echo "✘ Couldn't find Vim revision '${vim_commit}'."
|
||||||
exit 3
|
exit 3
|
||||||
}
|
}
|
||||||
echo "✔ Found Vim revision '${vim_commit}'."
|
|
||||||
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() {
|
stage_patch() {
|
||||||
get_vim_patch "$1"
|
get_vim_patch "$1"
|
||||||
@@ -183,6 +198,7 @@ get_vim_patch() {
|
|||||||
echo " branch; not creating a new branch."
|
echo " branch; not creating a new branch."
|
||||||
else
|
else
|
||||||
printf "\nFetching '${git_remote}/master'.\n"
|
printf "\nFetching '${git_remote}/master'.\n"
|
||||||
|
output="$(git fetch "${git_remote}" master 2>&1)" &&
|
||||||
echo "✔ ${output}" ||
|
echo "✔ ${output}" ||
|
||||||
(echo "✘ ${output}"; false)
|
(echo "✘ ${output}"; false)
|
||||||
|
|
||||||
@@ -196,14 +212,6 @@ get_vim_patch() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\nCreating empty commit with correct commit message.\n"
|
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 -)" &&
|
output="$(commit_message | git commit --allow-empty --file 2>&1 -)" &&
|
||||||
echo "✔ ${output}" ||
|
echo "✔ ${output}" ||
|
||||||
(echo "✘ ${output}"; false)
|
(echo "✘ ${output}"; false)
|
||||||
@@ -218,8 +226,7 @@ get_vim_patch() {
|
|||||||
current branch, call '${BASENAME} -p' again.
|
current branch, call '${BASENAME} -p' again.
|
||||||
* Do this only for _related_ patches (otherwise it increases the
|
* Do this only for _related_ patches (otherwise it increases the
|
||||||
size of the pull request, making it harder to review)
|
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.
|
When you're done, try '${BASENAME} -s' to create the pull request.
|
||||||
|
|
||||||
See the wiki for more information:
|
See the wiki for more information:
|
||||||
@@ -430,7 +437,7 @@ review_pr() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
clean_files
|
clean_files
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,6 +448,10 @@ while getopts "hlp:r:s" opt; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
l)
|
l)
|
||||||
|
list_vim_patches
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
p)
|
||||||
stage_patch "${OPTARG}"
|
stage_patch "${OPTARG}"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
Reference in New Issue
Block a user