mirror of
https://github.com/neovim/neovim.git
synced 2026-01-03 01:46:31 +10:00
feat(vim-patch.sh): add n flag to list possible N/A patches (#36431)
Scan all unmerged Vim commits to determine which commits are N/A for Neovim. vim_na_regexp.txt contains the file patterns to filter out N/A files in a Vim commit. vim_na_files.txt contains "absolute filepath" of N/A files. It relies on vim_na_regexp.txt to reduce file size. If version.c remains and it has the expected 2-liner update, then it's considered N/A. https://github.com/neovim/neovim/discussions/36326
This commit is contained in:
@@ -34,6 +34,7 @@ usage() {
|
||||
echo " -L [git-log opts] List missing Vim patches (for scripts)."
|
||||
echo " -m {vim-revision} List previous (older) missing Vim patches."
|
||||
echo " -M List all merged patch-numbers (at current v:version)."
|
||||
echo " -n List possible N/A Vim patches."
|
||||
echo " -p {vim-revision} Download and generate a Vim patch. vim-revision"
|
||||
echo " can be a Vim version (8.1.xxx) or a Git hash."
|
||||
echo " -P {vim-revision} Download, generate and apply a Vim patch."
|
||||
@@ -886,7 +887,41 @@ review_pr() {
|
||||
clean_files
|
||||
}
|
||||
|
||||
while getopts "hlLmMVp:P:g:r:s" opt; do
|
||||
is_na_patch() {
|
||||
local patch=$1
|
||||
local NA_REGEXP="$NVIM_SOURCE_DIR/scripts/vim_na_regexp.txt"
|
||||
local NA_FILELIST="$NVIM_SOURCE_DIR/scripts/vim_na_files.txt"
|
||||
|
||||
local FILE_LNUM
|
||||
# shellcheck disable=SC2086
|
||||
FILE_LNUM="$(diff <(git -C "${VIM_SOURCE_DIR}" diff-tree --no-commit-id --name-only -r "$patch" | grep -v -f "$NA_REGEXP") "$NA_FILELIST" |
|
||||
grep -c '^<')" || FILE_LNUM=0
|
||||
test "$FILE_LNUM" -gt 1 && return 1
|
||||
if test "$FILE_LNUM" -eq 1; then
|
||||
local VERSION_LNUM
|
||||
VERSION_LNUM=$(git -C "${VIM_SOURCE_DIR}" log -1 --numstat --format= "$patch" -- src/version.c | grep -c '^2\s\+0')
|
||||
test "$VERSION_LNUM" -ne 1 && return 1
|
||||
local VERSION_VNUM
|
||||
VERSION_VNUM="$(git -C "${VIM_SOURCE_DIR}" log -1 -U1 --format="" "$patch" -- src/version.c |
|
||||
grep -Pzc '[ +]\/\*\*\/\n\+\s+[0-9]+,\n[ +]\/\*\*\/\n')" || true
|
||||
test "$VERSION_VNUM" -ne 1 && return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
list_na_patches() {
|
||||
list_missing_vimpatches 0 | while read -r patch; do
|
||||
if is_na_patch "$patch"; then
|
||||
if (echo "$patch" | grep -q '^v[0-9]'); then
|
||||
echo "vim-patch:$(git -C "${VIM_SOURCE_DIR}" log -1 --pretty=format:%s "$patch" | sed 's/^patch //')"
|
||||
else
|
||||
echo "vim-patch:$(git -C "${VIM_SOURCE_DIR}" log -1 --oneline "$patch")"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
while getopts "hlLmnMVp:P:g:r:s" opt; do
|
||||
case ${opt} in
|
||||
h)
|
||||
usage
|
||||
@@ -911,6 +946,10 @@ while getopts "hlLmMVp:P:g:r:s" opt; do
|
||||
list_missing_previous_vimpatches_for_patch "$@"
|
||||
exit 0
|
||||
;;
|
||||
n)
|
||||
list_na_patches
|
||||
exit 0
|
||||
;;
|
||||
p)
|
||||
stage_patch "${OPTARG}"
|
||||
exit
|
||||
|
||||
88
scripts/vim_na_files.txt
Normal file
88
scripts/vim_na_files.txt
Normal file
@@ -0,0 +1,88 @@
|
||||
Filelist
|
||||
LICENSE
|
||||
SECURITY.md
|
||||
configure
|
||||
runtime/bugreport.vim
|
||||
runtime/defaults.vim
|
||||
runtime/doc/debugger.txt
|
||||
runtime/doc/doctags.vim
|
||||
runtime/doc/farsi.txt
|
||||
runtime/doc/hangulin.txt
|
||||
runtime/doc/howto.txt
|
||||
runtime/doc/if_cscop.txt
|
||||
runtime/doc/if_mzsch.txt
|
||||
runtime/doc/if_ole.txt
|
||||
runtime/doc/if_sniff.txt
|
||||
runtime/doc/if_tcl.txt
|
||||
runtime/doc/os_390.txt
|
||||
runtime/doc/os_amiga.txt
|
||||
runtime/doc/os_beos.txt
|
||||
runtime/doc/os_dos.txt
|
||||
runtime/doc/os_mac.txt
|
||||
runtime/doc/os_mint.txt
|
||||
runtime/doc/os_msdos.txt
|
||||
runtime/doc/os_os2.txt
|
||||
runtime/doc/os_qnx.txt
|
||||
runtime/doc/os_risc.txt
|
||||
runtime/doc/os_unix.txt
|
||||
runtime/doc/os_vms.txt
|
||||
runtime/doc/testing.txt
|
||||
runtime/doc/todo.txt
|
||||
runtime/doc/usr_90.txt
|
||||
runtime/doc/workshop.txt
|
||||
runtime/evim.vim
|
||||
runtime/macmap.vim
|
||||
runtime/macros/editexisting.vim
|
||||
runtime/macros/justify.vim
|
||||
runtime/macros/matchit.vim
|
||||
runtime/macros/shellmenu.vim
|
||||
runtime/macros/swapmous.vim
|
||||
runtime/pack/dist/opt/editexisting/plugin/editexisting.vim
|
||||
runtime/pack/dist/opt/shellmenu/plugin/shellmenu.vim
|
||||
runtime/plugin/README.txt
|
||||
runtime/plugin/rrhelper.vim
|
||||
runtime/syntax/syncolor.vim
|
||||
runtime/termcap
|
||||
runtime/tools/README.txt
|
||||
runtime/tools/ccfilter_README.txt
|
||||
runtime/tools/efm_filter.txt
|
||||
runtime/tools/mve.txt
|
||||
runtime/tools/ref
|
||||
runtime/tools/unicode.vim
|
||||
runtime/tools/vim132
|
||||
runtime/tools/vim_vs_net.cmd
|
||||
runtime/tools/vimm
|
||||
runtime/tools/vimspell.sh
|
||||
runtime/tools/vimspell.txt
|
||||
src/hardcopy.c
|
||||
src/mysign
|
||||
src/po/ko.po
|
||||
src/po/pl.po
|
||||
src/po/vim.pot
|
||||
src/po/zh_CN.cp936.po
|
||||
src/po/zh_CN.po
|
||||
src/po/zh_TW.po
|
||||
src/testdir/Make_amiga.mak
|
||||
src/testdir/Make_dos.mak
|
||||
src/testdir/samples/crypt_sodium_invalid.txt
|
||||
src/testdir/test_behave.vim
|
||||
src/testdir/test_crypt.vim
|
||||
src/testdir/test_cscope.vim
|
||||
src/testdir/test_hardcopy.vim
|
||||
src/testdir/test_job_fails.vim
|
||||
src/testdir/test_json.vim
|
||||
src/testdir/test_listener.vim
|
||||
src/testdir/test_mzscheme.vim
|
||||
src/testdir/test_python2.vim
|
||||
src/testdir/test_pyx2.vim
|
||||
src/testdir/test_restricted.vim
|
||||
src/testdir/test_shortpathname.vim
|
||||
src/testdir/test_tcl.vim
|
||||
src/testdir/test_xxd.vim
|
||||
src/testdir/util/amiga.vim
|
||||
src/testdir/util/dos.vim
|
||||
src/testdir/util/vms.vim
|
||||
src/typemap
|
||||
src/uninstall.c
|
||||
src/vimrun.c
|
||||
uninstall.txt
|
||||
90
scripts/vim_na_regexp.txt
Normal file
90
scripts/vim_na_regexp.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
^\.
|
||||
^README
|
||||
^ci/
|
||||
^lang/
|
||||
^nsis/
|
||||
^pixmaps/
|
||||
^runtime/colors/tools/
|
||||
^runtime/doc/gui_
|
||||
^runtime/doc/version[4-6]\.txt
|
||||
^runtime/doc/vim9
|
||||
^runtime/hi[1-9]
|
||||
^runtime/icons
|
||||
^runtime/indent/testdir/
|
||||
^runtime/lang/
|
||||
^runtime/macros/hanoi
|
||||
^runtime/macros/life/
|
||||
^runtime/macros/maze
|
||||
^runtime/macros/urm
|
||||
^runtime/pack/dist/opt/dvorak/
|
||||
^runtime/pack/dist/opt/editorconfig/
|
||||
^runtime/print/
|
||||
^runtime/syntax/generator/
|
||||
^runtime/syntax/testdir/
|
||||
^runtime/tutor/it/
|
||||
^runtime/tutor/ru/
|
||||
^runtime/tutor/sr/
|
||||
^runtime/vim[0-9l]
|
||||
^runtime/.\+\.c$
|
||||
^runtime/.\+\.mak$
|
||||
^runtime/.\+Makefile$
|
||||
^runtime/.\+getscript
|
||||
^runtime/.\+vimball
|
||||
^src/.*popupwin
|
||||
^src/.\+\.sh
|
||||
^src/GvimExt/
|
||||
^src/INSTALL
|
||||
^src/Make
|
||||
^src/[a-z]\+_cmdidxs\.h$
|
||||
^src/auto/
|
||||
^src/beval
|
||||
^src/bigvim
|
||||
^src/config\.[a-z]
|
||||
^src/configure
|
||||
^src/crypt
|
||||
^src/gui[_.]
|
||||
^src/if_
|
||||
^src/install
|
||||
^src/libvterm/
|
||||
^src/link\.
|
||||
^src/msvc[-2]
|
||||
^src/msys[36]
|
||||
^src/ndebug
|
||||
^src/os_amiga
|
||||
^src/os_haiku
|
||||
^src/os_qnx
|
||||
^src/os_vms
|
||||
^src/osdef
|
||||
^src/po/.*sjis
|
||||
^src/proto
|
||||
^src/testdir/dumps/
|
||||
^src/testdir/python
|
||||
^src/testdir/test_balloon
|
||||
^src/testdir/test_channel
|
||||
^src/testdir/test_terminal
|
||||
^src/testdir/test_vim9
|
||||
^src/tool[a-z]
|
||||
^src/vim\.[^h]
|
||||
^src/vim9
|
||||
^src/xpm
|
||||
^src/xxd/
|
||||
^tools/
|
||||
\.1$
|
||||
\.aap$
|
||||
\.awk$
|
||||
\.bmp$
|
||||
\.desktop$
|
||||
\.diff$
|
||||
\.ico$
|
||||
\.info$
|
||||
\.man$
|
||||
\.mms$
|
||||
\.pl$
|
||||
\.xbm$
|
||||
_example\.vim$
|
||||
/tags$
|
||||
README_[a-z]\+\.txt$
|
||||
[_.]cp125[0-1]
|
||||
netbeans
|
||||
textprop
|
||||
vimtutor
|
||||
Reference in New Issue
Block a user