remove 'grep' dependency
First step towards proper Windows support.
This commit is contained in:
parent
866f3d945d
commit
ae2f0bffdc
@ -245,8 +245,8 @@ endfunction
|
|||||||
|
|
||||||
" Functions -> s:repo_detect() {{{1
|
" Functions -> s:repo_detect() {{{1
|
||||||
function! s:repo_detect(path) abort
|
function! s:repo_detect(path) abort
|
||||||
if !executable('grep') || !executable('diff')
|
if !executable('diff')
|
||||||
echo 'signify: I cannot work without grep and diff!'
|
echo 'signify: I cannot work without diff!'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for type in s:vcs_list
|
for type in s:vcs_list
|
||||||
@ -262,7 +262,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_git {{{1
|
" Functions -> s:repo_get_diff_git {{{1
|
||||||
function! s:repo_get_diff_git(path) abort
|
function! s:repo_get_diff_git(path) abort
|
||||||
if executable('git')
|
if executable('git')
|
||||||
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 -- '. shellescape(a:path) .' | grep --color=never "^@@ "')
|
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && git diff --no-ext-diff -U0 -- '. shellescape(a:path))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -270,7 +270,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_hg {{{1
|
" Functions -> s:repo_get_diff_hg {{{1
|
||||||
function! s:repo_get_diff_hg(path) abort
|
function! s:repo_get_diff_hg(path) abort
|
||||||
if executable('hg')
|
if executable('hg')
|
||||||
let diff = system('hg diff --nodates -U0 -- '. shellescape(a:path) .' | grep --color=never "^@@ "')
|
let diff = system('hg diff --nodates -U0 -- '. shellescape(a:path))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -278,7 +278,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_svn {{{1
|
" Functions -> s:repo_get_diff_svn {{{1
|
||||||
function! s:repo_get_diff_svn(path) abort
|
function! s:repo_get_diff_svn(path) abort
|
||||||
if executable('svn')
|
if executable('svn')
|
||||||
let diff = system('svn diff --diff-cmd diff -x -U0 -- '. shellescape(a:path) .' | grep --color=never "^@@ "')
|
let diff = system('svn diff --diff-cmd diff -x -U0 -- '. shellescape(a:path))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -286,7 +286,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_bzr {{{1
|
" Functions -> s:repo_get_diff_bzr {{{1
|
||||||
function! s:repo_get_diff_bzr(path) abort
|
function! s:repo_get_diff_bzr(path) abort
|
||||||
if executable('bzr')
|
if executable('bzr')
|
||||||
let diff = system('bzr diff --using diff --diff-options=-U0 -- '. shellescape(a:path) .' | grep --color=never "^@@ "')
|
let diff = system('bzr diff --using diff --diff-options=-U0 -- '. shellescape(a:path))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -294,7 +294,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_darcs {{{1
|
" Functions -> s:repo_get_diff_darcs {{{1
|
||||||
function! s:repo_get_diff_darcs(path) abort
|
function! s:repo_get_diff_darcs(path) abort
|
||||||
if executable('darcs')
|
if executable('darcs')
|
||||||
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="diff -U0 %1 %2" -- '. shellescape(a:path) .' | grep --color=never "^@@ "')
|
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && darcs diff --no-pause-for-gui --diff-command="diff -U0 %1 %2" -- '. shellescape(a:path))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -302,7 +302,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_cvs {{{1
|
" Functions -> s:repo_get_diff_cvs {{{1
|
||||||
function! s:repo_get_diff_cvs(path) abort
|
function! s:repo_get_diff_cvs(path) abort
|
||||||
if executable('cvs')
|
if executable('cvs')
|
||||||
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 -- '. shellescape(fnamemodify(a:path, ':t')) .' | grep --color=never "^@@ "')
|
let diff = system('cd '. shellescape(fnamemodify(a:path, ':h')) .' && cvs diff -U0 -- '. shellescape(fnamemodify(a:path, ':t')))
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -310,7 +310,7 @@ endfunction
|
|||||||
" Functions -> s:repo_get_diff_rcs {{{1
|
" Functions -> s:repo_get_diff_rcs {{{1
|
||||||
function! s:repo_get_diff_rcs(path) abort
|
function! s:repo_get_diff_rcs(path) abort
|
||||||
if executable('rcs')
|
if executable('rcs')
|
||||||
let diff = system('rcsdiff -U0 '. shellescape(a:path) .' 2>/dev/null | grep --color=never "^@@ "')
|
let diff = system('rcsdiff -U0 '. shellescape(a:path) .' 2>/dev/null')
|
||||||
return v:shell_error ? '' : diff
|
return v:shell_error ? '' : diff
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@ -320,6 +320,10 @@ function! s:repo_process_diff(path, diff) abort
|
|||||||
" Determine where we have to put our signs.
|
" Determine where we have to put our signs.
|
||||||
for line in split(a:diff, '\n')
|
for line in split(a:diff, '\n')
|
||||||
" Parse diff output.
|
" Parse diff output.
|
||||||
|
if line !~ '^@@'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
let tokens = matchlist(line, '^\v\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)')
|
let tokens = matchlist(line, '^\v\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)')
|
||||||
if empty(tokens)
|
if empty(tokens)
|
||||||
echo 'signify: I cannot parse this line "'. line .'"'
|
echo 'signify: I cannot parse this line "'. line .'"'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user