Mercurial > vim-lawrencium
changeset 126:47209552ec46
Shellescaped all command arguments in HgRepo.GetCommand,
so that the commands work properly with ugly file names,
in my case containing parentheses.
Wrapping revision arguments in quotes is no longer necessary,
so removed all of that as well.
author | namark <nshan.nnnn@gmail.com> |
---|---|
date | Wed, 02 Dec 2015 22:45:12 +0400 |
parents | a9136d95cf47 |
children | 96e4423e729e |
files | plugin/lawrencium.vim |
diffstat | 1 files changed, 5 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/plugin/lawrencium.vim Tue Oct 06 23:13:43 2015 -0700 +++ b/plugin/lawrencium.vim Wed Dec 02 22:45:12 2015 +0400 @@ -61,11 +61,6 @@ return fnamemodify(a:path, ':s?[/\\]$??') endfunction -" Surrounds the given string with double quotes. -function! s:addquotes(str) - return '"' . a:str . '"' -endfunction - " Returns whether a path is absolute. function! s:isabspath(path) return a:path =~# '\v^(\w\:)?[/\\]' @@ -359,11 +354,7 @@ let l:hg_command = g:lawrencium_hg_executable . ' --repository ' . shellescape(s:stripslash(self.root_dir)) let l:hg_command = l:hg_command . ' ' . a:command for l:arg in l:arg_list - if stridx(l:arg, ' ') >= 0 - let l:hg_command = l:hg_command . ' "' . l:arg . '"' - else - let l:hg_command = l:hg_command . ' ' . l:arg - endif + let l:hg_command = l:hg_command . ' ' . shellescape(l:arg) endfor return l:hg_command endfunction @@ -672,7 +663,7 @@ if l:rev == '' call a:repo.ReadCommandOutput('cat', a:full_path) else - call a:repo.ReadCommandOutput('cat', '-r', s:addquotes(l:rev), a:full_path) + call a:repo.ReadCommandOutput('cat', '-r', l:rev, a:full_path) endif endfunction @@ -712,11 +703,11 @@ let l:rev1 = strpart(a:path_parts['value'], 0, l:commaidx) let l:rev2 = strpart(a:path_parts['value'], l:commaidx + 1) if l:rev1 == '-' - let l:diffargs = [ '-r', s:addquotes(l:rev2) ] + let l:diffargs = [ '-r', l:rev2 ] elseif l:rev2 == '-' - let l:diffargs = [ '-r', s:addquotes(l:rev1) ] + let l:diffargs = [ '-r', l:rev1 ] else - let l:diffargs = [ '-r', s:addquotes(l:rev1), '-r', s:addquotes(l:rev2) ] + let l:diffargs = [ '-r', l:rev1, '-r', l:rev2 ] endif elseif a:path_parts['value'] != '' let l:diffargs = [ '-c', a:path_parts['value'] ]