Add deprecation warnings to :Glog and :Gstatus

This commit is contained in:
Tim Pope
2021-04-12 12:06:18 -04:00
parent 47479a6cc2
commit 649cb2dc05
2 changed files with 2 additions and 3 deletions

View File

@@ -4835,9 +4835,6 @@ function! fugitive#LogCommand(line1, count, range, bang, mods, args, type) abort
\ args + extra_args + paths + extra_paths)
let state.target = path
let title = titlepre . (listnr < 0 ? 'Gclog ' : 'Gllog ') . s:fnameescape(args + paths)
if empty(paths + extra_paths) && empty(a:type) && a:count < 0 && len(s:Relative('/'))
let after = '|echohl WarningMsg|echo ' . string('Use :0Glog or :0Gclog for old behavior of targeting current file') . '|echohl NONE' . after
endif
return s:QuickfixStream(listnr, 'log', title, s:UserCommandList(dir) + cmd, !a:bang, a:mods, s:function('s:LogParse'), state, dir) . after
endfunction

View File

@@ -425,6 +425,7 @@ command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#Complete Git exe
if exists(':Gstatus') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bang -bar -range=-1' s:addr_other 'Gstatus exe fugitive#Command(<line1>, <count>, +"<range>", <bang>0, "<mods>", <q-args>)'
\ '|echohl WarningMSG|echo ":Gstatus is deprecated in favor of :Git (with no arguments)"|echohl NONE'
endif
for s:cmd in ['Commit', 'Revert', 'Merge', 'Rebase', 'Pull', 'Push', 'Fetch', 'Blame']
@@ -445,6 +446,7 @@ exe 'command! -bang -nargs=? -range=-1' s:addr_wins '-complete=customlist,fugiti
if exists(':Glog') != 2 && get(g:, 'fugitive_legacy_commands', 1)
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Glog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "")'
\ '|echohl WarningMSG|echo ":Glog is deprecated in favor of :Gclog"|echohl NONE'
endif
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete Gclog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'
exe 'command! -bang -nargs=? -range=-1 -complete=customlist,fugitive#LogComplete GcLog :exe fugitive#LogCommand(<line1>,<count>,+"<range>",<bang>0,"<mods>",<q-args>, "c")'