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:
|
Features:
|
||||||
|
|
||||||
- supports git, mercurial
|
- supports git, mercurial, bzr
|
||||||
- apart from signs there is also optional line highlighting
|
- apart from signs there is also optional line highlighting
|
||||||
- you can toggle the plugin per buffer
|
- you can toggle the plugin per buffer
|
||||||
- fully configurable through global variables
|
- fully configurable through global variables
|
||||||
|
@ -47,6 +47,7 @@ version control system:
|
|||||||
|
|
||||||
- git
|
- git
|
||||||
- mercurial
|
- mercurial
|
||||||
|
- bzr
|
||||||
|
|
||||||
The plugin defines 3 new kinds of signs and their corresponding highlighting
|
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
|
classes. It tries to inherent existing colors from the LineNr class, if that
|
||||||
|
@ -115,6 +115,11 @@ endfunction
|
|||||||
|
|
||||||
" Functions -> s:get_diff() {{{2
|
" Functions -> s:get_diff() {{{2
|
||||||
function! s:get_diff(path) abort
|
function! s:get_diff(path) abort
|
||||||
|
if !executable('grep')
|
||||||
|
echoerr "signify: I cannot work without grep!"
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if executable('git')
|
if executable('git')
|
||||||
let diff = system('git diff --no-ext-diff -U0 '. fnameescape(a:path) .'| grep "^@@ "')
|
let diff = system('git diff --no-ext-diff -U0 '. fnameescape(a:path) .'| grep "^@@ "')
|
||||||
if !v:shell_error
|
if !v:shell_error
|
||||||
@ -129,6 +134,13 @@ function! s:get_diff(path) abort
|
|||||||
endif
|
endif
|
||||||
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 []
|
return []
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -205,7 +217,7 @@ function! s:process_diff(diff) abort
|
|||||||
" Parse diff output.
|
" Parse diff output.
|
||||||
let tokens = matchlist(line, '\v^\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)')
|
let tokens = matchlist(line, '\v^\@\@ -(\d+),?(\d*) \+(\d+),?(\d*)')
|
||||||
if empty(tokens)
|
if empty(tokens)
|
||||||
echoerr 'signify: Could not parse this line "'. line .'"'
|
echoerr 'signify: I cannot parse this line "'. line .'"'
|
||||||
endif
|
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]) ]
|
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