comparison plugin/lawrencium.vim @ 125:bbb19d37c681

Don't use `HGPLAIN` for `:Hg`.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 16 Feb 2016 22:44:44 -0800
parents d5602a22bab5
children 96e4423e729e
comparison
equal deleted inserted replaced
124:d5602a22bab5 125:bbb19d37c681
373 return l:hg_command 373 return l:hg_command
374 endfunction 374 endfunction
375 375
376 " Runs a Mercurial command in the repo. 376 " Runs a Mercurial command in the repo.
377 function! s:HgRepo.RunCommand(command, ...) abort 377 function! s:HgRepo.RunCommand(command, ...) abort
378 let l:all_args = [1, a:command] + a:000
379 return call(self['RunCommandEx'], l:all_args, self)
380 endfunction
381
382 function! s:HgRepo.RunCommandEx(plain_mode, command, ...) abort
378 let l:prev_hgplain = $HGPLAIN 383 let l:prev_hgplain = $HGPLAIN
379 let $HGPLAIN = 'true' 384 if a:plain_mode
385 let $HGPLAIN = 'true'
386 endif
380 let l:all_args = [a:command] + a:000 387 let l:all_args = [a:command] + a:000
381 let l:hg_command = call(self['GetCommand'], l:all_args, self) 388 let l:hg_command = call(self['GetCommand'], l:all_args, self)
382 call s:trace("Running Mercurial command: " . l:hg_command) 389 call s:trace("Running Mercurial command: " . l:hg_command)
383 let l:cmd_out = system(l:hg_command) 390 let l:cmd_out = system(l:hg_command)
384 let $HGPLAIN = l:prev_hgplain 391 if a:plain_mode
392 let $HGPLAIN = l:prev_hgplain
393 endif
385 return l:cmd_out 394 return l:cmd_out
386 endfunction 395 endfunction
387 396
388 " Runs a Mercurial command in the repo and reads its output into the current 397 " Runs a Mercurial command in the repo and reads its output into the current
389 " buffer. 398 " buffer.
882 if g:lawrencium_auto_cd 891 if g:lawrencium_auto_cd
883 " Temporary set the current directory to the root of the repo 892 " Temporary set the current directory to the root of the repo
884 " to make auto-completed paths work magically. 893 " to make auto-completed paths work magically.
885 execute 'cd! ' . fnameescape(l:repo.root_dir) 894 execute 'cd! ' . fnameescape(l:repo.root_dir)
886 endif 895 endif
887 let l:output = call(l:repo.RunCommand, a:000, l:repo) 896 let l:output = call(l:repo.RunCommandEx, [0] + a:000, l:repo)
888 if g:lawrencium_auto_cd 897 if g:lawrencium_auto_cd
889 execute 'cd! -' 898 execute 'cd! -'
890 endif 899 endif
891 silent doautocmd User HgCmdPost 900 silent doautocmd User HgCmdPost
892 if a:bang 901 if a:bang