From e42cf0faf66fee52ce1110e5d2317b254c0dd4cd Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Mon, 19 Feb 2007 21:50:39 +0000 Subject: [PATCH] r8@localhost: bob | 2007-02-08 11:02:13 -0600 Added VCSDelete command. Added pass-through parameters to Add, Delete, Log, Status, Lock, and Unlock. git-svn-id: https://vcscommand.googlecode.com/svn/trunk@7 e7462f97-9721-0410-a4e7-d7c98e439057 --- doc/vcscommand.txt | 26 ++++++++++++++++++-------- plugin/vcscommand.vim | 19 ++++++++++++++----- plugin/vcscvs.vim | 19 ++++++++++++++----- plugin/vcssvn.vim | 29 ++++++++++++++++++++--------- 4 files changed, 66 insertions(+), 27 deletions(-) diff --git a/doc/vcscommand.txt b/doc/vcscommand.txt index 110f639..45ec091 100644 --- a/doc/vcscommand.txt +++ b/doc/vcscommand.txt @@ -100,6 +100,7 @@ vcscommand defines the following commands: |:VCSAdd| |:VCSAnnotate| |:VCSCommit| +|:VCSDelete| |:VCSDiff| |:VCSGotoOriginal| |:VCSLog| @@ -128,7 +129,8 @@ The following commands are specific to SVN files: :VCSAdd *:VCSAdd* This command adds the current file to source control. Please note, this does -not commit the newly-added file. +not commit the newly-added file. All parameters to the command are passed to +the underlying VCS. :VCSAnnotate *:VCSAnnotate* @@ -162,6 +164,11 @@ Alternatively, the mapping that is used to invoke :VCSCommit (by default is useful if the |VCSCommandCommitOnWrite| variable is set to 0 to disable the normal commit-on-write behavior. +:VCSDelete *:VCSDelete* + +Deletes the current file and removes it from source control. All parameters +to the command are passed to the underlying VCS. + :VCSDiff *:VCSDiff* With no arguments, this displays the differences between the current file and @@ -196,13 +203,15 @@ buffers associated with the original file. This command locks the current file in order to prevent other users from concurrently modifying it. The exact semantics of this command depend on the -underlying VCS. This does nothing in CVS. +underlying VCS. This does nothing in CVS. All parameters are passed to the +underlying VCS. :VCSLog *:VCSLog* -Displays the version history of the current file in a new scratch buffer. Any -options are taken as revision parameters to be passed through to the -underlying VCS. +Displays the version history of the current file in a new scratch buffer. If +there is one parameter supplied, it is taken as as a revision parameters to be +passed through to the underlying VCS. Otherwise, all parameters are passed to +the underlying VCS. :VCSRevert *:VCSRevert* @@ -218,14 +227,14 @@ branch is retrieved. :VCSStatus *:VCSStatus* Displays versioning information about the current file in a new scratch -buffer. +buffer. All parameters are passed to the underlying VCS. :VCSUnlock *:VCSUnlock* Unlocks the current file in order to allow other users from concurrently modifying it. The exact semantics of this command depend on the underlying -VCS. +VCS. All parameters are passed to the underlying VCS. :VCSUpdate *:VCSUpdate* @@ -296,7 +305,8 @@ This command performs "cvs watchers" on the current file. :SVNInfo *:SVNInfo* -This command performs "svn info" on the current file. +This command performs "svn info" on the current file. All parameters are +passed directly to svn. 4.2 Mappings *vcscommand-mappings* diff --git a/plugin/vcscommand.vim b/plugin/vcscommand.vim index fe05ad2..553bd68 100644 --- a/plugin/vcscommand.vim +++ b/plugin/vcscommand.vim @@ -64,6 +64,8 @@ " message. The commit can be abandoned if the log message " buffer is deleted or wiped before being written. " +" VCSDelete Deletes the current file and removes it from source control. +" " VCSDiff With no arguments, this displays the differences between " the current file and its parent version under source " control in a new scratch buffer. @@ -143,6 +145,7 @@ " ca VCSAdd " cn VCSAnnotate " cc VCSCommit +" cD VCSDelete " cd VCSDiff " cg VCSGotoOriginal " cG VCSGotoOriginal! @@ -1009,17 +1012,18 @@ endfunction " Section: Command definitions {{{1 " Section: Primary commands {{{2 -com! -nargs=0 VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', bufnr('%'), [])) +com! -nargs=* VCSAdd call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Add', bufnr('%'), [])) com! -nargs=? VCSAnnotate call s:ExecuteVCSCommand('Annotate', bufnr('%'), []) com! -nargs=? -bang VCSCommit call s:VCSCommit(, ) +com! -nargs=* VCSDelete call s:ExecuteVCSCommand('Delete', bufnr('%'), []) com! -nargs=* VCSDiff call s:ExecuteVCSCommand('Diff', bufnr('%'), []) com! -nargs=0 -bang VCSGotoOriginal call s:VCSGotoOriginal() -com! -nargs=0 VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', bufnr('%'), [])) -com! -nargs=? VCSLog call s:ExecuteVCSCommand('Log', bufnr('%'), []) +com! -nargs=* VCSLock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Lock', bufnr('%'), [])) +com! -nargs=* VCSLog call s:ExecuteVCSCommand('Log', bufnr('%'), []) com! -nargs=0 VCSRevert call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Revert', bufnr('%'), [])) com! -nargs=? VCSReview call s:ExecuteVCSCommand('Review', bufnr('%'), []) -com! -nargs=0 VCSStatus call s:ExecuteVCSCommand('Status', bufnr('%'), []) -com! -nargs=0 VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', bufnr('%'), [])) +com! -nargs=* VCSStatus call s:ExecuteVCSCommand('Status', bufnr('%'), []) +com! -nargs=* VCSUnlock call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Unlock', bufnr('%'), [])) com! -nargs=0 VCSUpdate call s:MarkOrigBufferForSetup(s:ExecuteVCSCommand('Update', bufnr('%'), [])) com! -nargs=* VCSVimDiff call s:VCSVimDiff() @@ -1034,6 +1038,7 @@ com! VCSReload let savedPluginFiles = s:pluginFiles|aunmenu Plugin.VCS|unlet! g: nnoremap VCSAdd :VCSAdd nnoremap VCSAnnotate :VCSAnnotate nnoremap VCSCommit :VCSCommit +nnoremap VCSDelete :VCSDelete nnoremap VCSDiff :VCSDiff nnoremap VCSGotoOriginal :VCSGotoOriginal nnoremap VCSClearAndGotoOriginal :VCSGotoOriginal! @@ -1059,6 +1064,9 @@ endif if !hasmapto('VCSCommit') nmap cc VCSCommit endif +if !hasmapto('VCSDelete') + nmap cD VCSDelete +endif if !hasmapto('VCSDiff') nmap cd VCSDiff endif @@ -1094,6 +1102,7 @@ endif amenu &Plugin.VCS.&Add VCSAdd amenu &Plugin.VCS.A&nnotate VCSAnnotate amenu &Plugin.VCS.&Commit VCSCommit +amenu &Plugin.VCS.Delete VCSDelete amenu &Plugin.VCS.&Diff VCSDiff amenu &Plugin.VCS.&Log VCSLog amenu &Plugin.VCS.Revert VCSRevert diff --git a/plugin/vcscvs.vim b/plugin/vcscvs.vim index 1f67d80..51f42d2 100644 --- a/plugin/vcscvs.vim +++ b/plugin/vcscvs.vim @@ -127,9 +127,9 @@ function! s:cvsFunctions.Identify(buffer) endif endfunction -" Function: s:cvsFunctions.Add() {{{2 +" Function: s:cvsFunctions.Add(argList) {{{2 function! s:cvsFunctions.Add(argList) - return s:DoCommand('add', 'add', '') + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' ')) endfunction " Function: s:cvsFunctions.Annotate(argList) {{{2 @@ -175,6 +175,11 @@ function! s:cvsFunctions.Commit(argList) return resultBuffer endfunction +" Function: s:cvsFunctions.Delete() {{{2 +function! s:cvsFunctions.Delete(argList) + return s:DoCommand(join(['remove -f'] + a:argList, ' '), 'delete', join(a:argList, ' ')) +endfunction + " Function: s:cvsFunctions.Diff(argList) {{{2 function! s:cvsFunctions.Diff(argList) if len(a:argList) == 1 @@ -249,9 +254,13 @@ function! s:cvsFunctions.Log(argList) if len(a:argList) == 0 let versionOption = '' let caption = '' - else - let versionOption=' -r' . a:argList[0] + elseif len(a:argList) == 1 && a:argList[0] !~ '^-' + let versionOption =' -r' . a:argList[0] let caption = a:argList[0] + else + " Multiple options, or the option starts with '-' + let caption = join(a:argList, ' ') + let versionOption = ' ' . caption endif let resultBuffer=s:DoCommand('log' . versionOption, 'log', caption) @@ -285,7 +294,7 @@ endfunction " Function: s:cvsFunctions.Status(argList) {{{2 function! s:cvsFunctions.Status(argList) - return s:DoCommand('status', 'status', '') + return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' ')) endfunction " Function: s:cvsFunctions.Update(argList) {{{2 diff --git a/plugin/vcssvn.vim b/plugin/vcssvn.vim index 2679bce..655cfe7 100644 --- a/plugin/vcssvn.vim +++ b/plugin/vcssvn.vim @@ -107,7 +107,7 @@ endfunction " Function: s:svnFunctions.Add() {{{2 function! s:svnFunctions.Add(argList) - return s:DoCommand('add', 'add', '') + return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' ')) endfunction " Function: s:svnFunctions.Annotate(argList) {{{2 @@ -145,6 +145,11 @@ function! s:svnFunctions.Commit(argList) endif endfunction +" Function: s:svnFunctions.Delete() {{{2 +function! s:svnFunctions.Delete(argList) + return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' ')) +endfunction + " Function: s:svnFunctions.Diff(argList) {{{2 function! s:svnFunctions.Diff(argList) if len(a:argList) == 1 @@ -225,7 +230,7 @@ endfunction " Function: s:svnFunctions.Lock(argList) {{{2 function! s:svnFunctions.Lock(argList) - return s:DoCommand('lock', 'lock', '') + return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' ')) endfunction " Function: s:svnFunctions.Log() {{{2 @@ -233,9 +238,13 @@ function! s:svnFunctions.Log(argList) if len(a:argList) == 0 let versionOption = '' let caption = '' - else + elseif len(a:argList) == 1 && a:argList[0] !~ "^-" let versionOption=' -r' . a:argList[0] let caption = a:argList[0] + else + " Multiple options, or the option starts with '-' + let caption = join(a:argList, ' ') + let versionOption = ' ' . caption endif let resultBuffer=s:DoCommand('log -v' . versionOption, 'log', caption) @@ -266,12 +275,15 @@ endfunction " Function: s:svnFunctions.Status(argList) {{{2 function! s:svnFunctions.Status(argList) - return s:DoCommand('status -u -v', 'status', '') + if len(a:argList) == 0 + let a:argList = ['-u', '-v'] + endif + return s:DoCommand(join(['status -u -v'] + a:argList, ' '), 'status', join(a:argList, ' ')) endfunction " Function: s:svnFunctions.Unlock(argList) {{{2 function! s:svnFunctions.Unlock(argList) - return s:DoCommand('unlock', 'unlock', '') + return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' ')) endfunction " Function: s:svnFunctions.Update(argList) {{{2 function! s:svnFunctions.Update(argList) @@ -281,13 +293,13 @@ endfunction " Section: SVN-specific functions {{{1 " Function: s:SVNInfo() {{{2 -function! s:SVNInfo() - return s:DoCommand('info', 'svninfo', '') +function! s:SVNInfo(argList) + return s:DoCommand(join(['info'] + a:argList, ' '), 'svninfo', join(a:argList, ' ')) endfunction " Section: Command definitions {{{1 " Section: Primary commands {{{2 -com! SVNInfo call s:SVNInfo() +com! -nargs=* SVNInfo call s:SVNInfo([]) " Section: Plugin command mappings {{{1 @@ -300,7 +312,6 @@ for [pluginName, commandText, shortCut] in mappingInfo endif endfor - " Section: Menu items {{{1 amenu &Plugin.VCS.SVN.&Info SVNInfo -- 2.11.4.GIT