comparison plugin/lawrencium.vim @ 116:7da11e029773

Revert files from the status window.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 24 Jan 2015 13:27:42 -0800
parents facd2506066f
children 2e38e754c896
comparison
equal deleted inserted replaced
115:53a2c9403ba8 116:7da11e029773
1012 command! -buffer Hgstatustabdiff :call s:HgStatus_Diff(2) 1012 command! -buffer Hgstatustabdiff :call s:HgStatus_Diff(2)
1013 command! -buffer Hgstatusdiffsum :call s:HgStatus_DiffSummary(1) 1013 command! -buffer Hgstatusdiffsum :call s:HgStatus_DiffSummary(1)
1014 command! -buffer Hgstatusvdiffsum :call s:HgStatus_DiffSummary(2) 1014 command! -buffer Hgstatusvdiffsum :call s:HgStatus_DiffSummary(2)
1015 command! -buffer Hgstatustabdiffsum :call s:HgStatus_DiffSummary(3) 1015 command! -buffer Hgstatustabdiffsum :call s:HgStatus_DiffSummary(3)
1016 command! -buffer Hgstatusrefresh :call s:HgStatus_Refresh() 1016 command! -buffer Hgstatusrefresh :call s:HgStatus_Refresh()
1017 command! -buffer -range -bang Hgstatusrevert :call s:HgStatus_Revert(<line1>, <line2>, <bang>0)
1017 command! -buffer -range Hgstatusaddremove :call s:HgStatus_AddRemove(<line1>, <line2>) 1018 command! -buffer -range Hgstatusaddremove :call s:HgStatus_AddRemove(<line1>, <line2>)
1018 command! -buffer -range=% -bang Hgstatuscommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 0) 1019 command! -buffer -range=% -bang Hgstatuscommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 0)
1019 command! -buffer -range=% -bang Hgstatusvcommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 1) 1020 command! -buffer -range=% -bang Hgstatusvcommit :call s:HgStatus_Commit(<line1>, <line2>, <bang>0, 1)
1020 command! -buffer -range=% -nargs=+ Hgstatusqnew :call s:HgStatus_QNew(<line1>, <line2>, <f-args>) 1021 command! -buffer -range=% -nargs=+ Hgstatusqnew :call s:HgStatus_QNew(<line1>, <line2>, <f-args>)
1021 command! -buffer -range=% Hgstatusqrefresh :call s:HgStatus_QRefresh(<line1>, <line2>) 1022 command! -buffer -range=% Hgstatusqrefresh :call s:HgStatus_QRefresh(<line1>, <line2>)
1103 endif 1104 endif
1104 1105
1105 " Run `addremove` on those paths. 1106 " Run `addremove` on those paths.
1106 let l:repo = s:hg_repo() 1107 let l:repo = s:hg_repo()
1107 call l:repo.RunCommand('addremove', l:filenames) 1108 call l:repo.RunCommand('addremove', l:filenames)
1109
1110 " Refresh the status window.
1111 call s:HgStatus_Refresh()
1112 endfunction
1113
1114 function! s:HgStatus_Revert(linestart, lineend, bang) abort
1115 " Get the selected filenames.
1116 let l:filenames = s:HgStatus_GetSelectedFiles(a:linestart, a:lineend, ['M', 'A', 'R'])
1117 if len(l:filenames) == 0
1118 call s:error("No files to revert in selection or current line.")
1119 return
1120 endif
1121
1122 " Run `revert` on those paths.
1123 " If the bang modifier is specified, revert with no backup.
1124 let l:repo = s:hg_repo()
1125 if a:bang
1126 call insert(l:filenames, '-C', 0)
1127 endif
1128 call l:repo.RunCommand('revert', l:filenames)
1108 1129
1109 " Refresh the status window. 1130 " Refresh the status window.
1110 call s:HgStatus_Refresh() 1131 call s:HgStatus_Refresh()
1111 endfunction 1132 endfunction
1112 1133