scripts/vim-patch.sh -l: display commit subjects

Closes https://github.com/neovim/neovim/pull/11182.
This commit is contained in:
Daniel Hahler
2019-10-13 23:09:09 +02:00
parent 9af0fe529d
commit 5cf6beb221

View File

@@ -366,7 +366,7 @@ submit_pr() {
continue continue
fi fi
rm -- "${NVIM_SOURCE_DIR}/${patch_file}" rm -- "${NVIM_SOURCE_DIR}/${patch_file}"
msg_ok "Removed '${NVIM_SOURCE_DIR}/${patch_file}'." msg_ok "Removed '${NVIM_SOURCE_DIR}/${patch_file}'."
done done
} }
@@ -389,6 +389,7 @@ list_vimpatch_numbers() {
# a "vim-patch:xxx" token in the Nvim git log. # a "vim-patch:xxx" token in the Nvim git log.
list_vimpatch_numbers() { list_vimpatch_numbers() {
# Transform "vim-patch:X.Y.ZZZZ" to "ZZZZ". # Transform "vim-patch:X.Y.ZZZZ" to "ZZZZ".
list_vimpatch_tokens | while read -r vimpatch_token; do
echo "$vimpatch_token" | grep '8\.0\.' | sed 's/.*vim-patch:8\.0\.\([0-9a-z]\+\).*/\1/' echo "$vimpatch_token" | grep '8\.0\.' | sed 's/.*vim-patch:8\.0\.\([0-9a-z]\+\).*/\1/'
done done
} }
@@ -396,6 +397,13 @@ list_missing_vimpatches() {
# Prints a newline-delimited list of Vim commits, for use by scripts. # Prints a newline-delimited list of Vim commits, for use by scripts.
# "$1": use extended format? # "$1": use extended format?
# "$@" is passed to list_vim_commits, as extra arguments to git-log. # "$@" is passed to list_vim_commits, as extra arguments to git-log.
list_missing_vimpatches() {
local token vim_commit vim_tag patch_number
declare -A tokens
declare -A vim_commit_tags
declare -a git_log_args
local extended_format=$1; shift
if [[ "$extended_format" == 1 ]]; then if [[ "$extended_format" == 1 ]]; then
git_log_args=("--format=%H %s") git_log_args=("--format=%H %s")
else else
@@ -431,13 +439,27 @@ list_missing_vimpatches() {
)" )"
# Exit in case of errors from the above eval (empty vim_commit_tags). # Exit in case of errors from the above eval (empty vim_commit_tags).
if ! (( "${#vim_commit_tags[@]}" )); then if ! (( "${#vim_commit_tags[@]}" )); then
msg_err "Could not get Vim commits/tags." msg_err "Could not get Vim commits/tags."
exit 1
fi fi
fi
# Get missing Vim commits # Get missing Vim commits
set +u # Avoid "unbound variable" with bash < 4.4 below. set +u # Avoid "unbound variable" with bash < 4.4 below.
local vim_commit info local vim_commit info
while IFS=' ' read -r line; do while IFS=' ' read -r line; do
# Check for vim-patch:<commit_hash> (usually runtime updates).
token="vim-patch:${line:0:7}"
if [[ "${tokens[$token]-}" ]]; then
continue
fi
# Get commit hash, and optional info from line. This is used in
# extended mode, and when using e.g. '--format' manually.
vim_commit=${line%% *}
if [[ "$vim_commit" == "$line" ]]; then
info=
else
info=${line#* }
if [[ -n $info ]]; then if [[ -n $info ]]; then
# Remove any "patch 8.0.0902: " prefixes, and prefix with ": ". # Remove any "patch 8.0.0902: " prefixes, and prefix with ": ".
info=": ${info#patch*: }" info=": ${info#patch*: }"
@@ -445,11 +467,11 @@ list_missing_vimpatches() {
fi fi
vim_tag="${vim_commit_tags[$vim_commit]-}" vim_tag="${vim_commit_tags[$vim_commit]-}"
if [[ -n "$vim_tag" ]]; then if [[ -n "$vim_tag" ]]; then
# Check for vim-patch:<tag> (not commit hash). # Check for vim-patch:<tag> (not commit hash).
patch_number="vim-patch:${vim_tag:1}" # "v7.4.0001" => "7.4.0001" patch_number="vim-patch:${vim_tag:1}" # "v7.4.0001" => "7.4.0001"
if [[ "${tokens[$patch_number]-}" ]]; then if [[ "${tokens[$patch_number]-}" ]]; then
continue continue
fi fi
printf '%s%s\n' "$vim_tag" "$info" printf '%s%s\n' "$vim_tag" "$info"
else else
@@ -464,7 +486,7 @@ show_vimpatches() {
show_vimpatches() { show_vimpatches() {
get_vim_sources get_vim_sources
printf "\nVim patches missing from Neovim:\n" printf "\nVim patches missing from Neovim:\n"
local -A runtime_commits local -A runtime_commits
for commit in $(git -C "${VIM_SOURCE_DIR}" log --format="%H %D" -- runtime | sed 's/,\? tag: / /g'); do for commit in $(git -C "${VIM_SOURCE_DIR}" log --format="%H %D" -- runtime | sed 's/,\? tag: / /g'); do
runtime_commits[$commit]=1 runtime_commits[$commit]=1
@@ -596,7 +618,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do
exit 0 exit 0
;; ;;
l) l)
shift # remove opt shift # remove opt
show_vimpatches "$@" show_vimpatches "$@"
exit 0 exit 0
;; ;;