Minor syntactic style changes

This commit is contained in:
Marco Hinz 2013-08-07 15:46:37 +02:00
parent 52d025975b
commit 78a96c4b49
2 changed files with 23 additions and 43 deletions

View File

@ -24,7 +24,7 @@ else
endif
endif
let s:diffoptions = ''
let s:diffoptions = get(g:, 'signify_diffoptions', {})
" Function: #detect {{{1
function! sy#repo#detect(path) abort
@ -41,10 +41,8 @@ endfunction
" Function: #get_diff_git {{{1
function! sy#repo#get_diff_git(path) abort
if executable('git')
if exists('g:signify_diffoptions["git"]')
let s:diffoptions = g:signify_diffoptions['git']
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'git') ? s:diffoptions.git : ''
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction
@ -83,10 +81,8 @@ endfunction
" Function: #get_diff_hg {{{1
function! sy#repo#get_diff_hg(path) abort
if executable('hg')
if exists('g:signify_diffoptions["hg"]')
let s:diffoptions = g:signify_diffoptions['hg']
endif
let diff = system('hg diff --nodates -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'hg') ? s:diffoptions.hg : ''
let diff = system('hg diff --nodates -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction
@ -94,10 +90,8 @@ endfunction
" Function: #get_diff_svn {{{1
function! sy#repo#get_diff_svn(path) abort
if executable('svn')
if exists('g:signify_diffoptions["svn"]')
let s:diffoptions = g:signify_diffoptions['svn']
endif
let diff = system('svn diff --diff-cmd '. s:difftool .' -x -U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'svn') ? s:diffoptions.svn : ''
let diff = system('svn diff --diff-cmd '. s:difftool .' -x -U0 '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction
@ -105,10 +99,8 @@ endfunction
" Function: #get_diff_bzr {{{1
function! sy#repo#get_diff_bzr(path) abort
if executable('bzr')
if exists('g:signify_diffoptions["bzr"]')
let s:diffoptions = g:signify_diffoptions['bzr']
endif
let diff = system('bzr diff --using '. s:difftool .' --diff-options=-U0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'bzr') ? s:diffoptions.bzr : ''
let diff = system('bzr diff --using '. s:difftool .' --diff-options=-U0 '. diffoptions .' -- '. sy#util#escape(a:path))
return ((v:shell_error == 0) || (v:shell_error == 1) || (v:shell_error == 2)) ? diff : ''
endif
endfunction
@ -116,10 +108,8 @@ endfunction
" Function: #get_diff_darcs {{{1
function! sy#repo#get_diff_darcs(path) abort
if executable('darcs')
if exists('g:signify_diffoptions["darcs"]')
let s:diffoptions = g:signify_diffoptions['darcs']
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="'. s:difftool .' -U0 %1 %2" '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'darcs') ? s:diffoptions.darcs : ''
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="'. s:difftool .' -U0 %1 %2" '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction
@ -127,10 +117,8 @@ endfunction
" Function: #get_diff_fossil {{{1
function! sy#repo#get_diff_fossil(path) abort
if executable('fossil')
if exists('g:signify_diffoptions["fossil"]')
let s:diffoptions = g:signify_diffoptions['fossil']
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && fossil set diff-command "'. s:difftool .' -U 0" && fossil diff --unified -c 0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'fossil') ? s:diffoptions.fossil : ''
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && fossil set diff-command "'. s:difftool .' -U 0" && fossil diff --unified -c 0 '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction
@ -138,10 +126,8 @@ endfunction
" Function: #get_diff_cvs {{{1
function! sy#repo#get_diff_cvs(path) abort
if executable('cvs')
if exists('g:signify_diffoptions["cvs"]')
let s:diffoptions = g:signify_diffoptions['cvs']
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 '. s:diffoptions .' -- '. sy#util#escape(fnamemodify(a:path, ':t')))
let diffoptions = has_key(s:diffoptions, 'cvs') ? s:diffoptions.cvs : ''
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 '. diffoptions .' -- '. sy#util#escape(fnamemodify(a:path, ':t')))
return v:shell_error ? '' : diff
endif
endfunction
@ -149,10 +135,8 @@ endfunction
" Function: #get_diff_rcs {{{1
function! sy#repo#get_diff_rcs(path) abort
if executable('rcs')
if exists('g:signify_diffoptions["rcs"]')
let s:diffoptions = g:signify_diffoptions['rcs']
endif
let diff = system('rcsdiff -U0 '. s:diffoptions .' '. sy#util#escape(a:path) .' 2>/dev/null')
let diffoptions = has_key(s:diffoptions, 'rcs') ? s:diffoptions.rcs : ''
let diff = system('rcsdiff -U0 '. diffoptions .' '. sy#util#escape(a:path) .' 2>/dev/null')
return v:shell_error ? '' : diff
endif
endfunction
@ -160,10 +144,8 @@ endfunction
" Function: #get_diff_accurev {{{1
function! sy#repo#get_diff_accurev(path) abort
if executable('accurev')
if exists('g:signify_diffoptions["accurev"]')
let s:diffoptions = g:signify_diffoptions['accurev']
endif
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && accurev diff '. sy#util#escape(fnamemodify(a:path, ':t')) . ' -- -U0 '. s:diffoptions)
let diffoptions = has_key(s:diffoptions, 'accurev') ? s:diffoptions.accurev : ''
let diff = system('cd '. sy#util#escape(fnamemodify(a:path, ':h')) .' && accurev diff '. sy#util#escape(fnamemodify(a:path, ':t')) . ' -- -U0 '. diffoptions)
return (v:shell_error != 1) ? '' : diff
endif
endfunction
@ -171,10 +153,8 @@ endfunction
" Function: #get_diff_perforce {{{1
function! sy#repo#get_diff_perforce(path) abort
if executable('p4')
if exists('g:signify_diffoptions["perforce"]')
let s:diffoptions = g:signify_diffoptions['perforce']
endif
let diff = system('env P4DIFF=diff p4 diff -dU0 '. s:diffoptions .' -- '. sy#util#escape(a:path))
let diffoptions = has_key(s:diffoptions, 'perforce') ? s:diffoptions.perforce : ''
let diff = system('env P4DIFF=diff p4 diff -dU0 '. diffoptions .' -- '. sy#util#escape(a:path))
return v:shell_error ? '' : diff
endif
endfunction

View File

@ -212,10 +212,10 @@ Default: Does not exist.
let g:signify_diffoptions = { 'git': '-w', 'hg': '-w' }
Default: No additional options.
This will pass the given additional options to the selected VCS diff command.
Default: Does not exist.
==============================================================================
4. Commands *signify-commands*