Improve detection performance (#67)

This commit is contained in:
Bailey Ling 2013-09-11 21:13:51 +00:00
parent f35b8dfac7
commit 3133fce524

View File

@ -18,9 +18,23 @@ endif
let s:diffoptions = get(g:, 'signify_diffoptions', {})
let s:vcs_list = get(g:, 'signify_vcs_list', [])
if empty(s:vcs_list)
if executable('git') | call add(s:vcs_list, 'git') | endif
if executable('hg') | call add(s:vcs_list, 'hg') | endif
if executable('svn') | call add(s:vcs_list, 'svn') | endif
if executable('darcs') | call add(s:vcs_list, 'darcs') | endif
if executable('bzr') | call add(s:vcs_list, 'bzr') | endif
if executable('fossil') | call add(s:vcs_list, 'fossil') | endif
if executable('cvs') | call add(s:vcs_list, 'cvs') | endif
if executable('rcsdiff') | call add(s:vcs_list, 'rcs') | endif
if executable('accurev') | call add(s:vcs_list, 'accurev') | endif
if executable('p4') | call add(s:vcs_list, 'perforce') | endif
endif
" Function: #detect {{{1
function! sy#repo#detect(path) abort
for type in get(g:, 'signify_vcs_list', [ 'git', 'hg', 'svn', 'darcs', 'bzr', 'fossil', 'cvs', 'rcs', 'accurev', 'perforce' ])
for type in s:vcs_list
let diff = sy#repo#get_diff_{type}(a:path)
if !empty(diff)
return [ diff, type ]