Mercurial > vim-lawrencium
changeset 39:42c40b8144f8
Merged changes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 23 Feb 2012 21:25:48 -0800 |
parents | a384b4aff211 (diff) f9abc2e2aa90 (current diff) |
children | a63ec818ab21 |
files | |
diffstat | 2 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/lawrencium.txt Mon Feb 13 15:41:45 2012 -0800 +++ b/doc/lawrencium.txt Thu Feb 23 21:25:48 2012 -0800 @@ -82,6 +82,14 @@ :Hgvcommit Same as |:Hgcommit| but uses a vertical split to edit the commit message. +:Hgrevert {files} *:Hgrevert* + Reverts the given files (in repo-relative paths). If no + file are given, reverts the current file. + +:Hgrevert! {files} *:Hgrevert!* + Same as |:Hgrevert| but with the --no-backup option + given to prevent a .orig backup file from being + created. =============================================================================
--- a/plugin/lawrencium.vim Mon Feb 13 15:41:45 2012 -0800 +++ b/plugin/lawrencium.vim Thu Feb 23 21:25:48 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