changeset 37:9361f6b9e5a4

Added `Hgrevert` command.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 23 Feb 2012 21:20:28 -0800
parents c3958d29878e
children a384b4aff211
files plugin/lawrencium.vim
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugin/lawrencium.vim	Wed Dec 28 11:24:53 2011 -0800
+++ b/plugin/lawrencium.vim	Thu Feb 23 21:20:28 2012 -0800
@@ -783,6 +783,29 @@
 
 " }}}
 
+" Hgrevert {{{
+
+function! s:HgRevert(bang, ...) abort
+    " Get the files to revert.
+    let l:filenames = a:000
+    if a:0 == 0
+        let l:filenames = [ expand('%:p') ]
+    endif
+    if a:bang
+        call insert(l:filenames, '--no-backup', 0)
+    endif
+
+    " Get the repo.
+    let l:repo = s:hg_repo()
+
+    " Run the command.
+    call l:repo.RunCommand('revert', l:filenames)
+endfunction
+
+call s:AddMainCommand("-bang -nargs=* -complete=customlist,s:ListRepoFiles Hgrevert :call s:HgRevert(<bang>0, <f-args>)")
+
+" }}}
+
 " Autoload Functions {{{
 
 " Prints a summary of the current repo (if any) that's appropriate for