add support for bazaar
This commit is contained in:
parent
506c2e2cbe
commit
8b3dfd0937
@ -12,7 +12,7 @@ It's fast, highly configurable and well documented.
|
||||
|
||||
Features:
|
||||
|
||||
- supports git, mercurial
|
||||
- supports git, mercurial, bzr
|
||||
- apart from signs there is also optional line highlighting
|
||||
- you can toggle the plugin per buffer
|
||||
- fully configurable through global variables
|
||||
|
@ -47,6 +47,7 @@ version control system:
|
||||
|
||||
- git
|
||||
- mercurial
|
||||
- bzr
|
||||
|
||||
The plugin defines 3 new kinds of signs and their corresponding highlighting
|
||||
classes. It tries to inherent existing colors from the LineNr class, if that
|
||||
|
@ -115,6 +115,11 @@ endfunction
|
||||
|
||||
" Functions -> s:get_diff() {{{2
|
||||
function! s:get_diff(path) abort
|
||||
if !executable('grep')
|
||||
echoerr "signify: I cannot work without grep!"
|
||||
finish
|
||||
endif
|
||||
|
||||
if executable('git')
|
||||
let diff = system('git diff --no-ext-diff -U0 '. fnameescape(a:path) .'| grep "^@@ "')
|
||||
if !v:shell_error
|
||||
@ -129,6 +134,13 @@ function! s:get_diff(path) abort
|
||||
endif
|
||||
endif
|
||||
|
||||
if executable('bzr') && executable('diff')
|
||||
let diff = system('bzr diff --using diff --diff-options=-U0 '. fnameescape(a:path) .'| grep "^@@ "')
|
||||
if !v:shell_error
|
||||
return diff
|
||||
endif
|
||||
endif
|
||||
|
||||
return []
|
||||
endfunction
|
||||
|
||||
@ -205,7 +217,7 @@ function! s:process_diff(diff) abort
|
||||
" Parse diff output.
|
||||
let tokens = matchlist(line, '\v^\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)')
|
||||
if empty(tokens)
|
||||
echoerr 'signify: Could not parse this line "'. line .'"'
|
||||
echoerr 'signify: I cannot parse this line "'. line .'"'
|
||||
endif
|
||||
|
||||
let [ old_line, old_count, new_line, new_count ] = [ str2nr(tokens[1]), (tokens[2] == '') ? 1 : str2nr(tokens[2]), str2nr(tokens[3]), (tokens[4] == '') ? 1 : str2nr(tokens[4]) ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user