Mercurial > vim-lawrencium
comparison autoload/lawrencium/revert.vim @ 139:065625e1bb31
Split plugin file into multiple extensions.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 13 Jun 2016 09:32:34 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
138:a2d823c82e5f | 139:065625e1bb31 |
---|---|
1 | |
2 function! lawrencium#revert#init() abort | |
3 call lawrencium#add_command("-bang -nargs=* -complete=customlist,lawrencium#list_repo_files Hgrevert :call lawrencium#revert#HgRevert(<bang>0, <f-args>)") | |
4 endfunction | |
5 | |
6 function! lawrencium#revert#HgRevert(bang, ...) abort | |
7 " Get the files to revert. | |
8 let l:filenames = a:000 | |
9 if a:0 == 0 | |
10 let l:filenames = [ expand('%:p') ] | |
11 endif | |
12 if a:bang | |
13 call insert(l:filenames, '--no-backup', 0) | |
14 endif | |
15 | |
16 " Get the repo and run the command. | |
17 let l:repo = lawrencium#hg_repo() | |
18 call l:repo.RunCommand('revert', l:filenames) | |
19 | |
20 " Re-edit the file to see the change. | |
21 edit | |
22 endfunction | |
23 |