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
1 changed files with 30 additions and 8 deletions

View File

@ -366,7 +366,7 @@ submit_pr() {
# Gets all Vim commits since the "start" commit.
list_vim_commits() { (
cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD "$@"
cd "${VIM_SOURCE_DIR}" && git log --reverse v8.0.0000..HEAD "$@"
) }
# Prints all (sorted) "vim-patch:xxx" tokens found in the Nvim git log.
@ -389,6 +389,7 @@ list_vimpatch_numbers() {
}
# Prints a newline-delimited list of Vim commits, for use by scripts.
# "$1": use extended format?
# "$@" is passed to list_vim_commits, as extra arguments to git-log.
list_missing_vimpatches() {
local token vim_commit vim_tag patch_number
@ -396,6 +397,13 @@ list_missing_vimpatches() {
declare -A vim_commit_tags
declare -a git_log_args
local extended_format=$1; shift
if [[ "$extended_format" == 1 ]]; then
git_log_args=("--format=%H %s")
else
git_log_args=("--format=%H")
fi
# Massage arguments for git-log.
declare -A git_log_replacements=(
[^\(.*/\)?src/nvim/\(.*\)]="\${BASH_REMATCH[1]}src/\${BASH_REMATCH[2]}"
@ -431,13 +439,27 @@ list_missing_vimpatches() {
# Get missing Vim commits
set +u # Avoid "unbound variable" with bash < 4.4 below.
for vim_commit in $(list_vim_commits "${git_log_args[@]}"); do
local vim_commit info
while IFS=' ' read -r line; do
# Check for vim-patch:<commit_hash> (usually runtime updates).
token="vim-patch:${vim_commit:0:7}"
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
# Remove any "patch 8.0.0902: " prefixes, and prefix with ": ".
info=": ${info#patch*: }"
fi
fi
vim_tag="${vim_commit_tags[$vim_commit]-}"
if [[ -n "$vim_tag" ]]; then
# Check for vim-patch:<tag> (not commit hash).
@ -445,11 +467,11 @@ list_missing_vimpatches() {
if [[ "${tokens[$patch_number]-}" ]]; then
continue
fi
echo "$vim_tag"
printf '%s%s\n' "$vim_tag" "$info"
else
echo "$vim_commit"
printf '%s%s\n' "$vim_commit" "$info"
fi
done
done < <(list_vim_commits "${git_log_args[@]}")
set -u
}
@ -464,7 +486,7 @@ show_vimpatches() {
runtime_commits[$commit]=1
done
list_missing_vimpatches "$@" | while read -r vim_commit; do
list_missing_vimpatches 1 "$@" | while read -r vim_commit; do
if [[ "${runtime_commits[$vim_commit]-}" ]]; then
printf ' • %s (+runtime)\n' "${vim_commit}"
else
@ -596,7 +618,7 @@ while getopts "hlLMVp:P:g:r:s" opt; do
;;
L)
shift # remove opt
list_missing_vimpatches "$@"
list_missing_vimpatches 0 "$@"
exit 0
;;
M)