changeset 127:96e4423e729e

Merge pull request #7 from GitHub.
author Ludovic Chabant <ludovic@chabant.com>
date Fri, 19 Feb 2016 15:39:56 -0800
parents bbb19d37c681 (current diff) 47209552ec46 (diff)
children 7ad578b151c1
files plugin/lawrencium.vim
diffstat 1 files changed, 5 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Tue Feb 16 22:44:44 2016 -0800
+++ b/plugin/lawrencium.vim	Fri Feb 19 15:39:56 2016 -0800
@@ -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\:)?[/\\]'
@@ -361,11 +356,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
     if l:prev_shellslash
         setlocal shellslash
@@ -690,7 +681,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
 
@@ -730,11 +721,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'] ]