[vim]Update VCS plugin
This commit is contained in:
parent
f48625243a
commit
0fc98a9065
@ -1,5 +1,5 @@
|
|||||||
*vcscommand.txt* vcscommand
|
*vcscommand.txt* vcscommand
|
||||||
Copyright (c) 2007 Bob Hiestand
|
Copyright (c) Bob Hiestand
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to
|
of this software and associated documentation files (the "Software"), to
|
||||||
@ -81,7 +81,7 @@ output appears in a new window.
|
|||||||
Many of the commands accept revisions as arguments. By default, most operate
|
Many of the commands accept revisions as arguments. By default, most operate
|
||||||
on the most recent revision on the current branch if no revision is specified.
|
on the most recent revision on the current branch if no revision is specified.
|
||||||
|
|
||||||
Each vcscommand is mapped to a key sequence starting with the <Leader>
|
Each vcscommand is mapped to a key sequence starting with the |<Leader>|
|
||||||
keystroke. The default mappings may be overridden by supplying different
|
keystroke. The default mappings may be overridden by supplying different
|
||||||
mappings before the plugin is loaded, such as in the vimrc, in the standard
|
mappings before the plugin is loaded, such as in the vimrc, in the standard
|
||||||
fashion for plugin mappings. For examples, please see
|
fashion for plugin mappings. For examples, please see
|
||||||
@ -131,7 +131,7 @@ This command adds the current file to source control. Please note, this does
|
|||||||
not commit the newly-added file. All parameters to the command are passed to
|
not commit the newly-added file. All parameters to the command are passed to
|
||||||
the underlying VCS.
|
the underlying VCS.
|
||||||
|
|
||||||
:VCSAnnotate *:VCSAnnotate*
|
:VCSAnnotate[!] *:VCSAnnotate*
|
||||||
|
|
||||||
This command displays the current file with each line annotated with the
|
This command displays the current file with each line annotated with the
|
||||||
version in which it was most recently changed. If an argument is given, the
|
version in which it was most recently changed. If an argument is given, the
|
||||||
@ -140,16 +140,19 @@ it uses the most recent version of the file (on the current branch, if under
|
|||||||
CVS control). Additionally, if the current buffer is a VCSAnnotate buffer
|
CVS control). Additionally, if the current buffer is a VCSAnnotate buffer
|
||||||
already, the version number on the current line is used.
|
already, the version number on the current line is used.
|
||||||
|
|
||||||
|
If '!' is used, the view of the annotated buffer is split so that the
|
||||||
|
annotation is in a separate window from the content, and each is highlighted
|
||||||
|
separately.
|
||||||
|
|
||||||
For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
|
For CVS buffers, the 'VCSCommandCVSAnnotateParent' option, if set to non-zero,
|
||||||
will cause the above behavior to change. Instead of annotating the version on
|
will cause the above behavior to change. Instead of annotating the version on
|
||||||
the current line, the parent revision is used instead, crossing branches if
|
the current line, the parent revision is used instead, crossing branches if
|
||||||
necessary.
|
necessary.
|
||||||
|
|
||||||
The filetype of the vcscommand scratch buffer is set to one of 'CVSAnnotate',
|
With no arguments the cursor will jump to the line in the annotated buffer
|
||||||
'SVNAnnotate', or 'SVKAnnotate' as appropriate, to take advantage of the
|
corresponding to the current line in the source buffer.
|
||||||
bundled syntax files.
|
|
||||||
|
|
||||||
:VCSBlame *:VCSBlame*
|
:VCSBlame[!] *:VCSBlame*
|
||||||
|
|
||||||
Alias for |:VCSAnnotate|.
|
Alias for |:VCSAnnotate|.
|
||||||
|
|
||||||
@ -168,9 +171,10 @@ log message. The commit can be abandoned if the log message buffer is deleted
|
|||||||
or wiped before being written.
|
or wiped before being written.
|
||||||
|
|
||||||
Alternatively, the mapping that is used to invoke :VCSCommit (by default
|
Alternatively, the mapping that is used to invoke :VCSCommit (by default
|
||||||
<Leader>cc) can be used in the log message buffer to immediately commit. This
|
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
|
||||||
is useful if the |VCSCommandCommitOnWrite| variable is set to 0 to disable the
|
buffer in Normal mode to immediately commit. This is useful if the
|
||||||
normal commit-on-write behavior.
|
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
|
||||||
|
commit-on-write behavior.
|
||||||
|
|
||||||
:VCSDelete *:VCSDelete*
|
:VCSDelete *:VCSDelete*
|
||||||
|
|
||||||
@ -325,45 +329,56 @@ This command performs "cvs watchers" on the current file.
|
|||||||
By default, a mapping is defined for each command. These mappings execute the
|
By default, a mapping is defined for each command. These mappings execute the
|
||||||
default (no-argument) form of each command.
|
default (no-argument) form of each command.
|
||||||
|
|
||||||
<Leader>ca VCSAdd
|
|<Leader>|ca VCSAdd
|
||||||
<Leader>cn VCSAnnotate
|
|<Leader>|cn VCSAnnotate
|
||||||
<Leader>cc VCSCommit
|
|<Leader>|cN VCSAnnotate!
|
||||||
<Leader>cD VCSDelete
|
|<Leader>|cc VCSCommit
|
||||||
<Leader>cd VCSDiff
|
|<Leader>|cD VCSDelete
|
||||||
<Leader>cg VCSGotoOriginal
|
|<Leader>|cd VCSDiff
|
||||||
<Leader>cG VCSGotoOriginal!
|
|<Leader>|cg VCSGotoOriginal
|
||||||
<Leader>ci VCSInfo
|
|<Leader>|cG VCSGotoOriginal!
|
||||||
<Leader>cl VCSLog
|
|<Leader>|ci VCSInfo
|
||||||
<Leader>cL VCSLock
|
|<Leader>|cl VCSLog
|
||||||
<Leader>cr VCSReview
|
|<Leader>|cL VCSLock
|
||||||
<Leader>cs VCSStatus
|
|<Leader>|cr VCSReview
|
||||||
<Leader>cu VCSUpdate
|
|<Leader>|cs VCSStatus
|
||||||
<Leader>cU VCSUnlock
|
|<Leader>|cu VCSUpdate
|
||||||
<Leader>cv VCSVimDiff
|
|<Leader>|cU VCSUnlock
|
||||||
|
|<Leader>|cv VCSVimDiff
|
||||||
|
|
||||||
Only for CVS buffers:
|
Only for CVS buffers:
|
||||||
|
|
||||||
<Leader>ce CVSEdit
|
|<Leader>|ce CVSEdit
|
||||||
<Leader>cE CVSEditors
|
|<Leader>|cE CVSEditors
|
||||||
<Leader>ct CVSUnedit
|
|<Leader>|ct CVSUnedit
|
||||||
<Leader>cwv CVSWatchers
|
|<Leader>|cwv CVSWatchers
|
||||||
<Leader>cwa CVSWatchAdd
|
|<Leader>|cwa CVSWatchAdd
|
||||||
<Leader>cwn CVSWatchOn
|
|<Leader>|cwn CVSWatchOn
|
||||||
<Leader>cwf CVSWatchOff
|
|<Leader>|cwf CVSWatchOff
|
||||||
<Leader>cwf CVSWatchRemove
|
|<Leader>|cwf CVSWatchRemove
|
||||||
|
|
||||||
*vcscommand-mappings-override*
|
*vcscommand-mappings-override*
|
||||||
|
|
||||||
The default mappings can be overriden by user-provided instead by mapping to
|
The default mappings can be overridden by user-provided instead by mapping to
|
||||||
<Plug>CommandName. This is especially useful when these mappings collide with
|
<Plug>CommandName. This is especially useful when these mappings collide with
|
||||||
other existing mappings (vim will warn of this during plugin initialization,
|
other existing mappings (vim will warn of this during plugin initialization,
|
||||||
but will not clobber the existing mappings).
|
but will not clobber the existing mappings).
|
||||||
|
|
||||||
For instance, to override the default mapping for :VCSAdd to set it to '\add',
|
There are three methods for controlling mapping:
|
||||||
add the following to the vimrc:
|
|
||||||
|
First, maps can be overriden for individual commands. For instance, to
|
||||||
|
override the default mapping for :VCSAdd to set it to '\add', add the
|
||||||
|
following to the vimrc:
|
||||||
|
|
||||||
nmap \add <Plug>VCSAdd
|
nmap \add <Plug>VCSAdd
|
||||||
|
|
||||||
|
Second, the default map prefix ('<Leader>c') can be overridden by defining the
|
||||||
|
|VCSCommandMapPrefix| variable.
|
||||||
|
|
||||||
|
Third, the entire set of default maps can be overridden by defining the
|
||||||
|
|VCSCommandMappings| variable.
|
||||||
|
|
||||||
|
|
||||||
4.3 Automatic buffer variables *vcscommand-buffer-variables*
|
4.3 Automatic buffer variables *vcscommand-buffer-variables*
|
||||||
|
|
||||||
Several buffer variables are defined in each vcscommand result buffer. These
|
Several buffer variables are defined in each vcscommand result buffer. These
|
||||||
@ -414,10 +429,16 @@ The following variables are available:
|
|||||||
|VCSCommandCVSExec|
|
|VCSCommandCVSExec|
|
||||||
|VCSCommandDeleteOnHide|
|
|VCSCommandDeleteOnHide|
|
||||||
|VCSCommandDiffSplit|
|
|VCSCommandDiffSplit|
|
||||||
|
|VCSCommandDisableAll|
|
||||||
|VCSCommandDisableMappings|
|
|VCSCommandDisableMappings|
|
||||||
|VCSCommandDisableExtensionMappings|
|
|VCSCommandDisableExtensionMappings|
|
||||||
|
|VCSCommandDisableMenu|
|
||||||
|VCSCommandEdit|
|
|VCSCommandEdit|
|
||||||
|VCSCommandEnableBufferSetup|
|
|VCSCommandEnableBufferSetup|
|
||||||
|
|VCSCommandMappings|
|
||||||
|
|VCSCommandMapPrefix|
|
||||||
|
|VCSCommandMenuPriority|
|
||||||
|
|VCSCommandMenuRoot|
|
||||||
|VCSCommandResultBufferNameExtension|
|
|VCSCommandResultBufferNameExtension|
|
||||||
|VCSCommandResultBufferNameFunction|
|
|VCSCommandResultBufferNameFunction|
|
||||||
|VCSCommandSplit|
|
|VCSCommandSplit|
|
||||||
@ -425,6 +446,8 @@ The following variables are available:
|
|||||||
|VCSCommandSVNDiffExt|
|
|VCSCommandSVNDiffExt|
|
||||||
|VCSCommandSVNDiffOpt|
|
|VCSCommandSVNDiffOpt|
|
||||||
|VCSCommandSVNExec|
|
|VCSCommandSVNExec|
|
||||||
|
|VCSCommandVCSTypeOverride|
|
||||||
|
|VCSCommandVCSTypePreference|
|
||||||
|
|
||||||
VCSCommandCommitOnWrite *VCSCommandCommitOnWrite*
|
VCSCommandCommitOnWrite *VCSCommandCommitOnWrite*
|
||||||
|
|
||||||
@ -453,6 +476,12 @@ VCSCommandDiffSplit *VCSCommandDiffSplit*
|
|||||||
This variable overrides the |VCSCommandSplit| variable, but only for buffers
|
This variable overrides the |VCSCommandSplit| variable, but only for buffers
|
||||||
created with |:VCSVimDiff|.
|
created with |:VCSVimDiff|.
|
||||||
|
|
||||||
|
VCSCommandDisableAll *VCSCommandDisableAll*
|
||||||
|
|
||||||
|
This variable, if set, prevents the plugin or any extensions from loading at
|
||||||
|
all. This is useful when a single runtime distribution is used on multiple
|
||||||
|
systems with varying versions.
|
||||||
|
|
||||||
VCSCommandDisableMappings *VCSCommandDisableMappings*
|
VCSCommandDisableMappings *VCSCommandDisableMappings*
|
||||||
|
|
||||||
This variable, if set to a non-zero value, prevents the default command
|
This variable, if set to a non-zero value, prevents the default command
|
||||||
@ -469,6 +498,11 @@ VCSCommandEdit *VCSCommandEdit*
|
|||||||
This variable controls whether the original buffer is replaced ('edit') or
|
This variable controls whether the original buffer is replaced ('edit') or
|
||||||
split ('split'). If not set, it defaults to 'split'.
|
split ('split'). If not set, it defaults to 'split'.
|
||||||
|
|
||||||
|
VCSCommandDisableMenu *VCSCommandDisableMenu*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, prevents the default command menu
|
||||||
|
from being set.
|
||||||
|
|
||||||
VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup*
|
VCSCommandEnableBufferSetup *VCSCommandEnableBufferSetup*
|
||||||
|
|
||||||
This variable, if set to a non-zero value, activates VCS buffer management
|
This variable, if set to a non-zero value, activates VCS buffer management
|
||||||
@ -477,6 +511,27 @@ mode see (|vcscommand-buffer-management|). This mode means that the
|
|||||||
is VCS-controlled. This is useful for displaying version information in the
|
is VCS-controlled. This is useful for displaying version information in the
|
||||||
status bar.
|
status bar.
|
||||||
|
|
||||||
|
VCSCommandMappings *VCSCommandMappings*
|
||||||
|
|
||||||
|
This variable, if set, overrides the default mappings used for shortcuts. It
|
||||||
|
should be a List of 2-element Lists, each containing a shortcut and function
|
||||||
|
name pair. The value of the '|VCSCommandMapPrefix|' variable will be added to
|
||||||
|
each shortcut.
|
||||||
|
|
||||||
|
VCSCommandMapPrefix *VCSCommandMapPrefix*
|
||||||
|
|
||||||
|
This variable, if set, overrides the default mapping prefix ('<Leader>c').
|
||||||
|
This allows customization of the mapping space used by the vcscommand
|
||||||
|
shortcuts.
|
||||||
|
|
||||||
|
VCSCommandMenuPriority *VCSCommandMenuPriority*
|
||||||
|
|
||||||
|
This variable, if set, overrides the default menu priority '' (empty)
|
||||||
|
|
||||||
|
VCSCommandMenuRoot *VCSCommandMenuRoot*
|
||||||
|
|
||||||
|
This variable, if set, overrides the default menu root 'Plugin.VCS'
|
||||||
|
|
||||||
VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension*
|
VCSCommandResultBufferNameExtension *VCSCommandResultBufferNameExtension*
|
||||||
|
|
||||||
This variable, if set to a non-blank value, is appended to the name of the VCS
|
This variable, if set to a non-blank value, is appended to the name of the VCS
|
||||||
@ -507,7 +562,8 @@ may occur.
|
|||||||
If set to 'horizontal', the resulting windows will be on stacked on top of
|
If set to 'horizontal', the resulting windows will be on stacked on top of
|
||||||
one another. If set to 'vertical', the resulting windows will be
|
one another. If set to 'vertical', the resulting windows will be
|
||||||
side-by-side. If not set, it defaults to 'horizontal' for all but
|
side-by-side. If not set, it defaults to 'horizontal' for all but
|
||||||
VCSVimDiff windows.
|
VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt'
|
||||||
|
setting, if set, otherwise 'vertical'.
|
||||||
|
|
||||||
VCSCommandSVKExec *VCSCommandSVKExec*
|
VCSCommandSVKExec *VCSCommandSVKExec*
|
||||||
|
|
||||||
@ -529,6 +585,22 @@ VCSCommandSVNExec *VCSCommandSVNExec*
|
|||||||
This variable controls the executable used for all SVN commands If not set,
|
This variable controls the executable used for all SVN commands If not set,
|
||||||
it defaults to "svn".
|
it defaults to "svn".
|
||||||
|
|
||||||
|
VCSCommandVCSTypeOverride *VCSCommandVCSTypeOverride*
|
||||||
|
|
||||||
|
This variable allows the VCS type detection to be overridden on a path-by-path
|
||||||
|
basis. The value of this variable is expected to be a List of Lists. Each
|
||||||
|
item in the high-level List is a List containing two elements. The first
|
||||||
|
element is a regular expression that will be matched against the full file
|
||||||
|
name of a given buffer. If it matches, the second element will be used as the
|
||||||
|
VCS type.
|
||||||
|
|
||||||
|
VCSCommandVCSTypePreference *VCSCommandVCSTypePreference*
|
||||||
|
|
||||||
|
This variable allows the VCS type detection to be weighted towards a specific
|
||||||
|
VCS, in case more than one potential VCS is detected as useable. The format
|
||||||
|
of the variable is either a list or a space-separated string containing the
|
||||||
|
ordered-by-preference abbreviations of the preferred VCS types.
|
||||||
|
|
||||||
5.2 VCSCommand events *vcscommand-events*
|
5.2 VCSCommand events *vcscommand-events*
|
||||||
|
|
||||||
For additional customization, vcscommand can trigger user-defined events.
|
For additional customization, vcscommand can trigger user-defined events.
|
||||||
@ -540,7 +612,7 @@ For instance, the following could be added to the vimrc to provide a 'q'
|
|||||||
mapping to quit a vcscommand scratch buffer:
|
mapping to quit a vcscommand scratch buffer:
|
||||||
|
|
||||||
augroup VCSCommand
|
augroup VCSCommand
|
||||||
au User VCSBufferCreated silent! nmap <unique> <buffer> q: bwipeout<cr>
|
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
The following hooks are available:
|
The following hooks are available:
|
||||||
@ -712,7 +784,7 @@ too often.
|
|||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
7. Changes from cvscommandi *cvscommand-changes*
|
7. Changes from cvscommand *cvscommand-changes*
|
||||||
|
|
||||||
1. Require Vim 7 in order to leverage several convenient features; also
|
1. Require Vim 7 in order to leverage several convenient features; also
|
||||||
because I wanted to play with Vim 7.
|
because I wanted to play with Vim 7.
|
||||||
|
264
.vim/plugin/vcsbzr.vim
Normal file
264
.vim/plugin/vcsbzr.vim
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" BZR extension for VCSCommand.
|
||||||
|
"
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
"
|
||||||
|
" Section: Documentation {{{1
|
||||||
|
"
|
||||||
|
" Options documentation: {{{2
|
||||||
|
"
|
||||||
|
" VCSCommandBZRExec
|
||||||
|
" This variable specifies the BZR executable. If not set, it defaults to
|
||||||
|
" 'bzr' executed from the user's executable path.
|
||||||
|
|
||||||
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if v:version < 700
|
||||||
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandBZRExec', 'bzr'))
|
||||||
|
" BZR is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:bzrFunctions = {}
|
||||||
|
|
||||||
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke bzr suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandBZRExec', 'bzr')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the BZR executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'BZR'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
else
|
||||||
|
throw 'BZR VCSCommand plugin called on non-BZR item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Identify(buffer) {{{2
|
||||||
|
function! s:bzrFunctions.Identify(buffer)
|
||||||
|
let fileName = resolve(bufname(a:buffer))
|
||||||
|
let l:save_bzr_log=$BZR_LOG
|
||||||
|
try
|
||||||
|
let $BZR_LOG=has("win32") || has("win95") || has("win64") || has("win16") ? "nul" : "/dev/null"
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . fileName . '"')
|
||||||
|
finally
|
||||||
|
let $BZR_LOG=l:save_bzr_log
|
||||||
|
endtry
|
||||||
|
if(v:shell_error)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Add() {{{2
|
||||||
|
function! s:bzrFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype ==? 'bzrannotate'
|
||||||
|
" Perform annotation of the version indicated by the current line.
|
||||||
|
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||||
|
let options = ' -r' . caption
|
||||||
|
else
|
||||||
|
let caption = ''
|
||||||
|
let options = ''
|
||||||
|
endif
|
||||||
|
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||||
|
let caption = a:argList[0]
|
||||||
|
let options = ' -r' . caption
|
||||||
|
else
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
let options = ' ' . caption
|
||||||
|
endif
|
||||||
|
|
||||||
|
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||||
|
if resultBuffer > 0
|
||||||
|
normal! 1G2dd
|
||||||
|
endif
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Commit(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Commit(argList)
|
||||||
|
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
if resultBuffer == 0
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Delete() {{{2
|
||||||
|
function! s:bzrFunctions.Delete(argList)
|
||||||
|
return s:DoCommand(join(['rm'] + a:argList, ' '), 'rm', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Diff(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Diff(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let revOptions = []
|
||||||
|
let caption = ''
|
||||||
|
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||||
|
let revOptions = ['-r' . join(a:argList, '..')]
|
||||||
|
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||||
|
else
|
||||||
|
" Pass-through
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
let revOptions = a:argList
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.GetBufferInfo() {{{2
|
||||||
|
" Provides version control details for the current file. Current version
|
||||||
|
" number and current repository version number are required to be returned by
|
||||||
|
" the vcscommand plugin.
|
||||||
|
" Returns: List of results: [revision, repository]
|
||||||
|
|
||||||
|
function! s:bzrFunctions.GetBufferInfo()
|
||||||
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
|
let fileName = resolve(bufname(originalBuffer))
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -S -- "' . fileName . '"')
|
||||||
|
let revision = s:VCSCommandUtility.system(s:Executable() . ' revno -- "' . fileName . '"')
|
||||||
|
if(v:shell_error)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" File not under BZR control.
|
||||||
|
if statusText =~ '^?'
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let [flags, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)')[1:2]
|
||||||
|
if revision == ''
|
||||||
|
" Error
|
||||||
|
return ['Unknown']
|
||||||
|
elseif flags =~ '^A'
|
||||||
|
return ['New', 'New']
|
||||||
|
else
|
||||||
|
return [revision, repository]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Info(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Info(argList)
|
||||||
|
return s:DoCommand(join(['version-info'] + a:argList, ' '), 'version-info', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Lock(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Lock(argList)
|
||||||
|
echomsg 'bzr lock is not necessary'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Log() {{{2
|
||||||
|
function! s:bzrFunctions.Log(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let options = []
|
||||||
|
let caption = ''
|
||||||
|
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||||
|
let options = ['-r' . join(a:argList, ':')]
|
||||||
|
let caption = options[0]
|
||||||
|
else
|
||||||
|
" Pass-through
|
||||||
|
let options = a:argList
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Revert(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('revert', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Review(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Review(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let versiontag = '(current)'
|
||||||
|
let versionOption = ''
|
||||||
|
else
|
||||||
|
let versiontag = a:argList[0]
|
||||||
|
let versionOption = ' -r ' . versiontag . ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Status(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Status(argList)
|
||||||
|
let options = ['-S']
|
||||||
|
if len(a:argList) != 0
|
||||||
|
let options = a:argList
|
||||||
|
endif
|
||||||
|
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:bzrFunctions.Unlock(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Unlock(argList)
|
||||||
|
echomsg 'bzr unlock is not necessary'
|
||||||
|
endfunction
|
||||||
|
" Function: s:bzrFunctions.Update(argList) {{{2
|
||||||
|
function! s:bzrFunctions.Update(argList)
|
||||||
|
return s:DoCommand('update', 'update', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:bzrFunctions.AnnotateSplitRegex = '^[^|]\+ | '
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
let s:VCSCommandUtility = VCSCommandRegisterModule('BZR', expand('<sfile>'), s:bzrFunctions, [])
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
File diff suppressed because it is too large
Load Diff
@ -2,10 +2,9 @@
|
|||||||
"
|
"
|
||||||
" CVS extension for VCSCommand.
|
" CVS extension for VCSCommand.
|
||||||
"
|
"
|
||||||
" Version: VCS development
|
|
||||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
" License:
|
" License:
|
||||||
" Copyright (c) 2007 Bob Hiestand
|
" Copyright (c) Bob Hiestand
|
||||||
"
|
"
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
" of this software and associated documentation files (the "Software"), to
|
" of this software and associated documentation files (the "Software"), to
|
||||||
@ -81,12 +80,18 @@
|
|||||||
|
|
||||||
" Section: Plugin header {{{1
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime plugin/vcscommand.vim
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
||||||
" CVS is not installed
|
" CVS is not installed
|
||||||
@ -102,23 +107,40 @@ let s:cvsFunctions = {}
|
|||||||
|
|
||||||
" Section: Utility functions {{{1
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke cvs suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandCVSExec', 'cvs')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
|
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
|
||||||
" command argument.
|
" command argument.
|
||||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
if VCSCommandGetVCSType(expand('%')) == 'CVS'
|
if VCSCommandGetVCSType(expand('%')) == 'CVS'
|
||||||
let fullCmd = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
let ret = VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
|
||||||
|
if ret > 0
|
||||||
|
if getline(line('$')) =~ '^cvs \w\+: closing down connection'
|
||||||
|
$d
|
||||||
|
1
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ret
|
||||||
else
|
else
|
||||||
throw 'CVS VCSCommand plugin called on non-CVS item.'
|
throw 'CVS VCSCommand plugin called on non-CVS item.'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: GetRevision() {{{2
|
" Function: s:GetRevision() {{{2
|
||||||
" Function for retrieving the current buffer's revision number.
|
" Function for retrieving the current buffer's revision number.
|
||||||
" Returns: Revision number or an empty string if an error occurs.
|
" Returns: Revision number or an empty string if an error occurs.
|
||||||
|
|
||||||
function! GetRevision()
|
function! s:GetRevision()
|
||||||
if !exists('b:VCSCommandBufferInfo')
|
if !exists('b:VCSCommandBufferInfo')
|
||||||
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
|
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
|
||||||
endif
|
endif
|
||||||
@ -160,7 +182,7 @@ endfunction
|
|||||||
" Function: s:cvsFunctions.Annotate(argList) {{{2
|
" Function: s:cvsFunctions.Annotate(argList) {{{2
|
||||||
function! s:cvsFunctions.Annotate(argList)
|
function! s:cvsFunctions.Annotate(argList)
|
||||||
if len(a:argList) == 0
|
if len(a:argList) == 0
|
||||||
if &filetype == 'CVSAnnotate'
|
if &filetype ==? 'cvsannotate'
|
||||||
" This is a CVSAnnotate buffer. Perform annotation of the version
|
" This is a CVSAnnotate buffer. Perform annotation of the version
|
||||||
" indicated by the current line.
|
" indicated by the current line.
|
||||||
let caption = matchstr(getline('.'),'\v^[0-9.]+')
|
let caption = matchstr(getline('.'),'\v^[0-9.]+')
|
||||||
@ -183,7 +205,7 @@ function! s:cvsFunctions.Annotate(argList)
|
|||||||
" CVS defaults to pulling HEAD, regardless of current branch.
|
" CVS defaults to pulling HEAD, regardless of current branch.
|
||||||
" Therefore, always pass desired revision.
|
" Therefore, always pass desired revision.
|
||||||
let caption = ''
|
let caption = ''
|
||||||
let options = ['-r' . GetRevision()]
|
let options = ['-r' . s:GetRevision()]
|
||||||
endif
|
endif
|
||||||
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||||
let caption = a:argList[0]
|
let caption = a:argList[0]
|
||||||
@ -195,7 +217,6 @@ function! s:cvsFunctions.Annotate(argList)
|
|||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
|
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
|
||||||
if resultBuffer > 0
|
if resultBuffer > 0
|
||||||
set filetype=CVSAnnotate
|
|
||||||
" Remove header lines from standard error
|
" Remove header lines from standard error
|
||||||
silent v/^\d\+\%(\.\d\+\)\+/d
|
silent v/^\d\+\%(\.\d\+\)\+/d
|
||||||
endif
|
endif
|
||||||
@ -245,13 +266,7 @@ function! s:cvsFunctions.Diff(argList)
|
|||||||
let diffOptions = ['-' . cvsDiffOpt]
|
let diffOptions = ['-' . cvsDiffOpt]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=diff
|
|
||||||
else
|
|
||||||
echomsg 'No differences found'
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:cvsFunctions.GetBufferInfo() {{{2
|
" Function: s:cvsFunctions.GetBufferInfo() {{{2
|
||||||
@ -280,7 +295,7 @@ function! s:cvsFunctions.GetBufferInfo()
|
|||||||
endif
|
endif
|
||||||
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
|
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
|
||||||
try
|
try
|
||||||
let statusText=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' status "' . realFileName . '"')
|
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
|
||||||
if(v:shell_error)
|
if(v:shell_error)
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
@ -317,11 +332,7 @@ function! s:cvsFunctions.Log(argList)
|
|||||||
let caption = join(a:argList, ' ')
|
let caption = join(a:argList, ' ')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer=s:DoCommand(join(['log'] + options), 'log', caption, {})
|
return s:DoCommand(join(['log'] + options), 'log', caption, {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=rcslog
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:cvsFunctions.Revert(argList) {{{2
|
" Function: s:cvsFunctions.Revert(argList) {{{2
|
||||||
@ -339,11 +350,7 @@ function! s:cvsFunctions.Review(argList)
|
|||||||
let versionOption = ' -r ' . versiontag . ' '
|
let versionOption = ' -r ' . versiontag . ' '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
|
return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
|
||||||
if resultBuffer > 0
|
|
||||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:cvsFunctions.Status(argList) {{{2
|
" Function: s:cvsFunctions.Status(argList) {{{2
|
||||||
@ -387,6 +394,9 @@ function! s:CVSWatchers()
|
|||||||
return s:DoCommand('watchers', 'cvswatchers', '', {})
|
return s:DoCommand('watchers', 'cvswatchers', '', {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:cvsFunctions.AnnotateSplitRegex = '): '
|
||||||
|
|
||||||
" Section: Command definitions {{{1
|
" Section: Command definitions {{{1
|
||||||
" Section: Primary commands {{{2
|
" Section: Primary commands {{{2
|
||||||
com! CVSEdit call s:CVSEdit()
|
com! CVSEdit call s:CVSEdit()
|
||||||
@ -402,36 +412,42 @@ com! CVSWatchers call s:CVSWatchers()
|
|||||||
" Section: Plugin command mappings {{{1
|
" Section: Plugin command mappings {{{1
|
||||||
|
|
||||||
let s:cvsExtensionMappings = {}
|
let s:cvsExtensionMappings = {}
|
||||||
let mappingInfo = [
|
if !exists("no_plugin_maps")
|
||||||
\['CVSEdit', 'CVSEdit', 'ce'],
|
let mappingInfo = [
|
||||||
\['CVSEditors', 'CVSEditors', 'cE'],
|
\['CVSEdit', 'CVSEdit', 'e'],
|
||||||
\['CVSUnedit', 'CVSUnedit', 'ct'],
|
\['CVSEditors', 'CVSEditors', 'E'],
|
||||||
\['CVSWatchers', 'CVSWatchers', 'cwv'],
|
\['CVSUnedit', 'CVSUnedit', 't'],
|
||||||
\['CVSWatchAdd', 'CVSWatch add', 'cwa'],
|
\['CVSWatchers', 'CVSWatchers', 'wv'],
|
||||||
\['CVSWatchOff', 'CVSWatch off', 'cwf'],
|
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
|
||||||
\['CVSWatchOn', 'CVSWatch on', 'cwn'],
|
\['CVSWatchOff', 'CVSWatch off', 'wf'],
|
||||||
\['CVSWatchRemove', 'CVSWatch remove', 'cwr']
|
\['CVSWatchOn', 'CVSWatch on', 'wn'],
|
||||||
|
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
|
||||||
\]
|
\]
|
||||||
|
|
||||||
for [pluginName, commandText, shortCut] in mappingInfo
|
for [pluginName, commandText, shortCut] in mappingInfo
|
||||||
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
||||||
if !hasmapto('<Plug>' . pluginName)
|
if !hasmapto('<Plug>' . pluginName)
|
||||||
let s:cvsExtensionMappings[shortCut] = commandText
|
let s:cvsExtensionMappings[shortCut] = commandText
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
endif
|
||||||
" Section: Menu items {{{1
|
|
||||||
silent! aunmenu Plugin.VCS.CVS
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.&Edit <Plug>CVSEdit
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.Ed&itors <Plug>CVSEditors
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.Unedi&t <Plug>CVSUnedit
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.&Watchers <Plug>CVSWatchers
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.WatchAdd <Plug>CVSWatchAdd
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.WatchOn <Plug>CVSWatchOn
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.WatchOff <Plug>CVSWatchOff
|
|
||||||
amenu <silent> &Plugin.VCS.CVS.WatchRemove <Plug>CVSWatchRemove
|
|
||||||
|
|
||||||
" Section: Plugin Registration {{{1
|
" Section: Plugin Registration {{{1
|
||||||
call VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
let s:VCSCommandUtility = VCSCommandRegisterModule('CVS', expand('<sfile>'), s:cvsFunctions, s:cvsExtensionMappings)
|
||||||
|
|
||||||
|
" Section: Menu items {{{1
|
||||||
|
for [s:shortcut, s:command] in [
|
||||||
|
\['CVS.&Edit', '<Plug>CVSEdit'],
|
||||||
|
\['CVS.Ed&itors', '<Plug>CVSEditors'],
|
||||||
|
\['CVS.Unedi&t', '<Plug>CVSUnedit'],
|
||||||
|
\['CVS.&Watchers', '<Plug>CVSWatchers'],
|
||||||
|
\['CVS.WatchAdd', '<Plug>CVSWatchAdd'],
|
||||||
|
\['CVS.WatchOn', '<Plug>CVSWatchOn'],
|
||||||
|
\['CVS.WatchOff', '<Plug>CVSWatchOff'],
|
||||||
|
\['CVS.WatchRemove', '<Plug>CVSWatchRemove']
|
||||||
|
\]
|
||||||
|
call s:VCSCommandUtility.addMenuItem(s:shortcut, s:command)
|
||||||
|
endfor
|
||||||
|
unlet s:shortcut s:command
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
"
|
"
|
||||||
" git extension for VCSCommand.
|
" git extension for VCSCommand.
|
||||||
"
|
"
|
||||||
" Version: VCS development
|
|
||||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
" License:
|
" License:
|
||||||
" Copyright (c) 2008 Bob Hiestand
|
" Copyright (c) Bob Hiestand
|
||||||
"
|
"
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
" of this software and associated documentation files (the "Software"), to
|
" of this software and associated documentation files (the "Software"), to
|
||||||
@ -40,12 +39,18 @@
|
|||||||
|
|
||||||
" Section: Plugin header {{{1
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime plugin/vcscommand.vim
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
||||||
" git is not installed
|
" git is not installed
|
||||||
@ -61,12 +66,19 @@ let s:gitFunctions = {}
|
|||||||
|
|
||||||
" Section: Utility functions {{{1
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke git suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandGitExec', 'git')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
|
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
|
||||||
" command argument.
|
" command argument.
|
||||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
if VCSCommandGetVCSType(expand('%')) == 'git'
|
if VCSCommandGetVCSType(expand('%')) == 'git'
|
||||||
let fullCmd = VCSCommandGetOption('VCSCommandGitExec', 'git',) . ' ' . a:cmd
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
else
|
else
|
||||||
throw 'git VCSCommand plugin called on non-git item.'
|
throw 'git VCSCommand plugin called on non-git item.'
|
||||||
@ -81,7 +93,7 @@ endfunction
|
|||||||
function! s:gitFunctions.Identify(buffer)
|
function! s:gitFunctions.Identify(buffer)
|
||||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||||
try
|
try
|
||||||
call system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --is-inside-work-tree')
|
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
|
||||||
if(v:shell_error)
|
if(v:shell_error)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -100,7 +112,7 @@ endfunction
|
|||||||
" Function: s:gitFunctions.Annotate(argList) {{{2
|
" Function: s:gitFunctions.Annotate(argList) {{{2
|
||||||
function! s:gitFunctions.Annotate(argList)
|
function! s:gitFunctions.Annotate(argList)
|
||||||
if len(a:argList) == 0
|
if len(a:argList) == 0
|
||||||
if &filetype == 'gitAnnotate'
|
if &filetype == 'gitannotate'
|
||||||
" Perform annotation of the version indicated by the current line.
|
" Perform annotation of the version indicated by the current line.
|
||||||
let options = matchstr(getline('.'),'^\x\+')
|
let options = matchstr(getline('.'),'^\x\+')
|
||||||
else
|
else
|
||||||
@ -112,21 +124,16 @@ function! s:gitFunctions.Annotate(argList)
|
|||||||
let options = join(a:argList, ' ')
|
let options = join(a:argList, ' ')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options, {})
|
return s:DoCommand('blame ' . options, 'annotate', options, {})
|
||||||
if resultBuffer > 0
|
|
||||||
normal 1G
|
|
||||||
set filetype=gitAnnotate
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:gitFunctions.Commit(argList) {{{2
|
" Function: s:gitFunctions.Commit(argList) {{{2
|
||||||
function! s:gitFunctions.Commit(argList)
|
function! s:gitFunctions.Commit(argList)
|
||||||
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
try
|
||||||
if resultBuffer == 0
|
return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
catch /\m^Version control command failed.*nothing\%( added\)\? to commit/
|
||||||
echomsg 'No commit needed.'
|
echomsg 'No commit needed.'
|
||||||
endif
|
endtry
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:gitFunctions.Delete() {{{2
|
" Function: s:gitFunctions.Delete() {{{2
|
||||||
@ -154,13 +161,7 @@ function! s:gitFunctions.Diff(argList)
|
|||||||
endfor
|
endfor
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
|
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=diff
|
|
||||||
else
|
|
||||||
echomsg 'No differences found'
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:gitFunctions.GetBufferInfo() {{{2
|
" Function: s:gitFunctions.GetBufferInfo() {{{2
|
||||||
@ -173,7 +174,7 @@ endfunction
|
|||||||
function! s:gitFunctions.GetBufferInfo()
|
function! s:gitFunctions.GetBufferInfo()
|
||||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
|
||||||
try
|
try
|
||||||
let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref -q HEAD'), '\n$', '', '')
|
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
let branch = 'DETACHED'
|
let branch = 'DETACHED'
|
||||||
else
|
else
|
||||||
@ -186,7 +187,7 @@ function! s:gitFunctions.GetBufferInfo()
|
|||||||
if method != ''
|
if method != ''
|
||||||
let method = ' --' . method
|
let method = ' --' . method
|
||||||
endif
|
endif
|
||||||
let tag = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe' . method), '\n$', '', '')
|
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
|
||||||
if !v:shell_error
|
if !v:shell_error
|
||||||
call add(info, tag)
|
call add(info, tag)
|
||||||
break
|
break
|
||||||
@ -201,11 +202,7 @@ endfunction
|
|||||||
|
|
||||||
" Function: s:gitFunctions.Log() {{{2
|
" Function: s:gitFunctions.Log() {{{2
|
||||||
function! s:gitFunctions.Log(argList)
|
function! s:gitFunctions.Log(argList)
|
||||||
let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
|
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=gitlog
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:gitFunctions.Revert(argList) {{{2
|
" Function: s:gitFunctions.Revert(argList) {{{2
|
||||||
@ -223,18 +220,14 @@ function! s:gitFunctions.Review(argList)
|
|||||||
|
|
||||||
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
|
||||||
try
|
try
|
||||||
let prefix = system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' rev-parse --show-prefix')
|
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
|
||||||
finally
|
finally
|
||||||
call VCSCommandChdir(oldCwd)
|
call VCSCommandChdir(oldCwd)
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
let prefix = substitute(prefix, '\n$', '', '')
|
let prefix = substitute(prefix, '\n$', '', '')
|
||||||
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
|
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
|
||||||
let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {})
|
return s:DoCommand('show ' . blob, 'review', revision, {})
|
||||||
if resultBuffer > 0
|
|
||||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:gitFunctions.Status(argList) {{{2
|
" Function: s:gitFunctions.Status(argList) {{{2
|
||||||
@ -247,8 +240,10 @@ function! s:gitFunctions.Update(argList)
|
|||||||
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
|
throw "This command is not implemented for git because file-by-file update doesn't make much sense in that context. If you have an idea for what it should do, please let me know."
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:gitFunctions.AnnotateSplitRegex = ') '
|
||||||
|
|
||||||
" Section: Plugin Registration {{{1
|
" Section: Plugin Registration {{{1
|
||||||
call VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
|
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
275
.vim/plugin/vcshg.vim
Normal file
275
.vim/plugin/vcshg.vim
Normal file
@ -0,0 +1,275 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" Mercurial extension for VCSCommand.
|
||||||
|
"
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
"
|
||||||
|
" Section: Documentation {{{1
|
||||||
|
"
|
||||||
|
" Options documentation: {{{2
|
||||||
|
"
|
||||||
|
" VCSCommandHGExec
|
||||||
|
" This variable specifies the mercurial executable. If not set, it defaults
|
||||||
|
" to 'hg' executed from the user's executable path.
|
||||||
|
"
|
||||||
|
" VCSCommandHGDiffExt
|
||||||
|
" This variable, if set, sets the external diff program used by Subversion.
|
||||||
|
"
|
||||||
|
" VCSCommandHGDiffOpt
|
||||||
|
" This variable, if set, determines the options passed to the hg diff
|
||||||
|
" command (such as 'u', 'w', or 'b').
|
||||||
|
|
||||||
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if v:version < 700
|
||||||
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandHGExec', 'hg'))
|
||||||
|
" HG is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:hgFunctions = {}
|
||||||
|
|
||||||
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke hg suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandHGExec', 'hg')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the HG executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'HG'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
else
|
||||||
|
throw 'HG VCSCommand plugin called on non-HG item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Identify(buffer) {{{2
|
||||||
|
function! s:hgFunctions.Identify(buffer)
|
||||||
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||||
|
try
|
||||||
|
call s:VCSCommandUtility.system(s:Executable() . ' root')
|
||||||
|
if(v:shell_error)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return g:VCSCOMMAND_IDENTIFY_INEXACT
|
||||||
|
endif
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Add() {{{2
|
||||||
|
function! s:hgFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add -v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:hgFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype ==? 'hgannotate'
|
||||||
|
" Perform annotation of the version indicated by the current line.
|
||||||
|
let caption = matchstr(getline('.'),'\v^\s*\w+\s+\zs\d+')
|
||||||
|
let options = ' -un -r' . caption
|
||||||
|
else
|
||||||
|
let caption = ''
|
||||||
|
let options = ' -un'
|
||||||
|
endif
|
||||||
|
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||||
|
let caption = a:argList[0]
|
||||||
|
let options = ' -un -r' . caption
|
||||||
|
else
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
let options = ' ' . caption
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Commit(argList) {{{2
|
||||||
|
function! s:hgFunctions.Commit(argList)
|
||||||
|
try
|
||||||
|
return s:DoCommand('commit -v -l "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
catch /Version control command failed.*nothing changed/
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Delete() {{{2
|
||||||
|
function! s:hgFunctions.Delete(argList)
|
||||||
|
return s:DoCommand(join(['remove'] + a:argList, ' '), 'remove', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Diff(argList) {{{2
|
||||||
|
function! s:hgFunctions.Diff(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let revOptions = []
|
||||||
|
let caption = ''
|
||||||
|
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||||
|
let revOptions = ['-r' . join(a:argList, ':')]
|
||||||
|
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||||
|
else
|
||||||
|
" Pass-through
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
let revOptions = a:argList
|
||||||
|
endif
|
||||||
|
|
||||||
|
let hgDiffExt = VCSCommandGetOption('VCSCommandHGDiffExt', '')
|
||||||
|
if hgDiffExt == ''
|
||||||
|
let diffExt = []
|
||||||
|
else
|
||||||
|
let diffExt = ['--diff-cmd ' . hgDiffExt]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let hgDiffOpt = VCSCommandGetOption('VCSCommandHGDiffOpt', '')
|
||||||
|
if hgDiffOpt == ''
|
||||||
|
let diffOptions = []
|
||||||
|
else
|
||||||
|
let diffOptions = ['-x -' . hgDiffOpt]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Info(argList) {{{2
|
||||||
|
function! s:hgFunctions.Info(argList)
|
||||||
|
return s:DoCommand(join(['log --limit 1'] + a:argList, ' '), 'log', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.GetBufferInfo() {{{2
|
||||||
|
" Provides version control details for the current file. Current version
|
||||||
|
" number and current repository version number are required to be returned by
|
||||||
|
" the vcscommand plugin.
|
||||||
|
" Returns: List of results: [revision, repository, branch]
|
||||||
|
|
||||||
|
function! s:hgFunctions.GetBufferInfo()
|
||||||
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
|
let fileName = bufname(originalBuffer)
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -- "' . fileName . '"')
|
||||||
|
if(v:shell_error)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" File not under HG control.
|
||||||
|
if statusText =~ '^?'
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let parentsText = s:VCSCommandUtility.system(s:Executable() . ' parents -- "' . fileName . '"')
|
||||||
|
let revision = matchlist(parentsText, '^changeset:\s\+\(\S\+\)\n')[1]
|
||||||
|
|
||||||
|
let logText = s:VCSCommandUtility.system(s:Executable() . ' log -- "' . fileName . '"')
|
||||||
|
let repository = matchlist(logText, '^changeset:\s\+\(\S\+\)\n')[1]
|
||||||
|
|
||||||
|
if revision == ''
|
||||||
|
" Error
|
||||||
|
return ['Unknown']
|
||||||
|
elseif statusText =~ '^A'
|
||||||
|
return ['New', 'New']
|
||||||
|
else
|
||||||
|
return [revision, repository]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Log(argList) {{{2
|
||||||
|
function! s:hgFunctions.Log(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let options = []
|
||||||
|
let caption = ''
|
||||||
|
elseif len(a:argList) <= 2 && match(a:argList, '^-') == -1
|
||||||
|
let options = ['-r' . join(a:argList, ':')]
|
||||||
|
let caption = options[0]
|
||||||
|
else
|
||||||
|
" Pass-through
|
||||||
|
let options = a:argList
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Revert(argList) {{{2
|
||||||
|
function! s:hgFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('revert', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Review(argList) {{{2
|
||||||
|
function! s:hgFunctions.Review(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let versiontag = '(current)'
|
||||||
|
let versionOption = ''
|
||||||
|
else
|
||||||
|
let versiontag = a:argList[0]
|
||||||
|
let versionOption = ' -r ' . versiontag . ' '
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Status(argList) {{{2
|
||||||
|
function! s:hgFunctions.Status(argList)
|
||||||
|
let options = ['-A', '-v']
|
||||||
|
if len(a:argList) != 0
|
||||||
|
let options = a:argList
|
||||||
|
endif
|
||||||
|
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:hgFunctions.Update(argList) {{{2
|
||||||
|
function! s:hgFunctions.Update(argList)
|
||||||
|
return s:DoCommand('update', 'update', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:hgFunctions.AnnotateSplitRegex = '\d\+: '
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
let s:VCSCommandUtility = VCSCommandRegisterModule('HG', expand('<sfile>'), s:hgFunctions, [])
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
@ -2,10 +2,9 @@
|
|||||||
"
|
"
|
||||||
" SVK extension for VCSCommand.
|
" SVK extension for VCSCommand.
|
||||||
"
|
"
|
||||||
" Version: VCS development
|
|
||||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
" License:
|
" License:
|
||||||
" Copyright (c) 2007 Bob Hiestand
|
" Copyright (c) Bob Hiestand
|
||||||
"
|
"
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
" of this software and associated documentation files (the "Software"), to
|
" of this software and associated documentation files (the "Software"), to
|
||||||
@ -35,12 +34,18 @@
|
|||||||
|
|
||||||
" Section: Plugin header {{{1
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime plugin/vcscommand.vim
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
||||||
" SVK is not installed
|
" SVK is not installed
|
||||||
@ -56,12 +61,19 @@ let s:svkFunctions = {}
|
|||||||
|
|
||||||
" Section: Utility functions {{{1
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke SVK suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandSVKExec', 'svk')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
|
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
|
||||||
" command argument.
|
" command argument.
|
||||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
if VCSCommandGetVCSType(expand('%')) == 'SVK'
|
if VCSCommandGetVCSType(expand('%')) == 'SVK'
|
||||||
let fullCmd = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . a:cmd
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
else
|
else
|
||||||
throw 'SVK VCSCommand plugin called on non-SVK item.'
|
throw 'SVK VCSCommand plugin called on non-SVK item.'
|
||||||
@ -78,7 +90,7 @@ function! s:svkFunctions.Identify(buffer)
|
|||||||
else
|
else
|
||||||
let directoryName = fnamemodify(fileName, ':p:h')
|
let directoryName = fnamemodify(fileName, ':p:h')
|
||||||
endif
|
endif
|
||||||
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
|
||||||
if(v:shell_error)
|
if(v:shell_error)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
@ -94,7 +106,7 @@ endfunction
|
|||||||
" Function: s:svkFunctions.Annotate(argList) {{{2
|
" Function: s:svkFunctions.Annotate(argList) {{{2
|
||||||
function! s:svkFunctions.Annotate(argList)
|
function! s:svkFunctions.Annotate(argList)
|
||||||
if len(a:argList) == 0
|
if len(a:argList) == 0
|
||||||
if &filetype == 'SVKAnnotate'
|
if &filetype ==? 'svkannotate'
|
||||||
" Perform annotation of the version indicated by the current line.
|
" Perform annotation of the version indicated by the current line.
|
||||||
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||||
let options = ' -r' . caption
|
let options = ' -r' . caption
|
||||||
@ -112,8 +124,7 @@ function! s:svkFunctions.Annotate(argList)
|
|||||||
|
|
||||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
||||||
if resultBuffer > 0
|
if resultBuffer > 0
|
||||||
normal 1G2dd
|
normal! 1G2dd
|
||||||
set filetype=SVKAnnotate
|
|
||||||
endif
|
endif
|
||||||
return resultBuffer
|
return resultBuffer
|
||||||
endfunction
|
endfunction
|
||||||
@ -145,13 +156,7 @@ function! s:svkFunctions.Diff(argList)
|
|||||||
let revOptions = a:argList
|
let revOptions = a:argList
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
|
return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=diff
|
|
||||||
else
|
|
||||||
echomsg 'No differences found'
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svkFunctions.GetBufferInfo() {{{2
|
" Function: s:svkFunctions.GetBufferInfo() {{{2
|
||||||
@ -163,7 +168,7 @@ endfunction
|
|||||||
function! s:svkFunctions.GetBufferInfo()
|
function! s:svkFunctions.GetBufferInfo()
|
||||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
let fileName = resolve(bufname(originalBuffer))
|
let fileName = resolve(bufname(originalBuffer))
|
||||||
let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' status -v "' . fileName . '"')
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
|
||||||
if(v:shell_error)
|
if(v:shell_error)
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
@ -227,17 +232,13 @@ function! s:svkFunctions.Review(argList)
|
|||||||
let versionOption = ' -r ' . versiontag . ' '
|
let versionOption = ' -r ' . versiontag . ' '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
return s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
||||||
if resultBuffer > 0
|
|
||||||
let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svkFunctions.Status(argList) {{{2
|
" Function: s:svkFunctions.Status(argList) {{{2
|
||||||
function! s:svkFunctions.Status(argList)
|
function! s:svkFunctions.Status(argList)
|
||||||
let options = ['-v']
|
let options = ['-v']
|
||||||
if len(a:argList) == 0
|
if len(a:argList) != 0
|
||||||
let options = a:argList
|
let options = a:argList
|
||||||
endif
|
endif
|
||||||
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
@ -253,6 +254,6 @@ function! s:svkFunctions.Update(argList)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Section: Plugin Registration {{{1
|
" Section: Plugin Registration {{{1
|
||||||
call VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
|
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
"
|
"
|
||||||
" SVN extension for VCSCommand.
|
" SVN extension for VCSCommand.
|
||||||
"
|
"
|
||||||
" Version: VCS development
|
|
||||||
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
" License:
|
" License:
|
||||||
" Copyright (c) 2007 Bob Hiestand
|
" Copyright (c) Bob Hiestand
|
||||||
"
|
"
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
" of this software and associated documentation files (the "Software"), to
|
" of this software and associated documentation files (the "Software"), to
|
||||||
@ -42,12 +41,18 @@
|
|||||||
|
|
||||||
" Section: Plugin header {{{1
|
" Section: Plugin header {{{1
|
||||||
|
|
||||||
|
if exists('VCSCommandDisableAll')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
if v:version < 700
|
if v:version < 700
|
||||||
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
runtime plugin/vcscommand.vim
|
if !exists('g:loaded_VCSCommand')
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
endif
|
||||||
|
|
||||||
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
||||||
" SVN is not installed
|
" SVN is not installed
|
||||||
@ -63,12 +68,19 @@ let s:svnFunctions = {}
|
|||||||
|
|
||||||
" Section: Utility functions {{{1
|
" Section: Utility functions {{{1
|
||||||
|
|
||||||
|
" Function: s:Executable() {{{2
|
||||||
|
" Returns the executable used to invoke git suitable for use in a shell
|
||||||
|
" command.
|
||||||
|
function! s:Executable()
|
||||||
|
return VCSCommandGetOption('VCSCommandSVNExec', 'svn')
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
" Function: s:DoCommand(cmd, cmdName, statusText, options) {{{2
|
||||||
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
|
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
|
||||||
" command argument.
|
" command argument.
|
||||||
function! s:DoCommand(cmd, cmdName, statusText, options)
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
if VCSCommandGetVCSType(expand('%')) == 'SVN'
|
if VCSCommandGetVCSType(expand('%')) == 'SVN'
|
||||||
let fullCmd = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . a:cmd
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
else
|
else
|
||||||
throw 'SVN VCSCommand plugin called on non-SVN item.'
|
throw 'SVN VCSCommand plugin called on non-SVN item.'
|
||||||
@ -79,22 +91,17 @@ endfunction
|
|||||||
|
|
||||||
" Function: s:svnFunctions.Identify(buffer) {{{2
|
" Function: s:svnFunctions.Identify(buffer) {{{2
|
||||||
function! s:svnFunctions.Identify(buffer)
|
function! s:svnFunctions.Identify(buffer)
|
||||||
let fileName = resolve(bufname(a:buffer))
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||||
if isdirectory(fileName)
|
try
|
||||||
let directoryName = fileName
|
call s:VCSCommandUtility.system(s:Executable() . ' info .')
|
||||||
else
|
if(v:shell_error)
|
||||||
let directoryName = fnamemodify(fileName, ':h')
|
|
||||||
endif
|
|
||||||
if strlen(directoryName) > 0
|
|
||||||
let svnDir = directoryName . '/.svn'
|
|
||||||
else
|
|
||||||
let svnDir = '.svn'
|
|
||||||
endif
|
|
||||||
if isdirectory(svnDir)
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
|
return g:VCSCOMMAND_IDENTIFY_EXACT
|
||||||
endif
|
endif
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Add() {{{2
|
" Function: s:svnFunctions.Add() {{{2
|
||||||
@ -105,7 +112,7 @@ endfunction
|
|||||||
" Function: s:svnFunctions.Annotate(argList) {{{2
|
" Function: s:svnFunctions.Annotate(argList) {{{2
|
||||||
function! s:svnFunctions.Annotate(argList)
|
function! s:svnFunctions.Annotate(argList)
|
||||||
if len(a:argList) == 0
|
if len(a:argList) == 0
|
||||||
if &filetype == 'SVNAnnotate'
|
if &filetype ==? 'svnannotate'
|
||||||
" Perform annotation of the version indicated by the current line.
|
" Perform annotation of the version indicated by the current line.
|
||||||
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
let caption = matchstr(getline('.'),'\v^\s+\zs\d+')
|
||||||
let options = ' -r' . caption
|
let options = ' -r' . caption
|
||||||
@ -121,16 +128,12 @@ function! s:svnFunctions.Annotate(argList)
|
|||||||
let options = ' ' . caption
|
let options = ' ' . caption
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
|
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=SVNAnnotate
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Commit(argList) {{{2
|
" Function: s:svnFunctions.Commit(argList) {{{2
|
||||||
function! s:svnFunctions.Commit(argList)
|
function! s:svnFunctions.Commit(argList)
|
||||||
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
let resultBuffer = s:DoCommand('commit --non-interactive -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
if resultBuffer == 0
|
if resultBuffer == 0
|
||||||
echomsg 'No commit needed.'
|
echomsg 'No commit needed.'
|
||||||
endif
|
endif
|
||||||
@ -138,7 +141,7 @@ endfunction
|
|||||||
|
|
||||||
" Function: s:svnFunctions.Delete() {{{2
|
" Function: s:svnFunctions.Delete() {{{2
|
||||||
function! s:svnFunctions.Delete(argList)
|
function! s:svnFunctions.Delete(argList)
|
||||||
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
return s:DoCommand(join(['delete --non-interactive'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Diff(argList) {{{2
|
" Function: s:svnFunctions.Diff(argList) {{{2
|
||||||
@ -169,15 +172,7 @@ function! s:svnFunctions.Diff(argList)
|
|||||||
let diffOptions = ['-x -' . svnDiffOpt]
|
let diffOptions = ['-x -' . svnDiffOpt]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||||
if resultBuffer > 0
|
|
||||||
set filetype=diff
|
|
||||||
else
|
|
||||||
if svnDiffExt == ''
|
|
||||||
echomsg 'No differences found'
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.GetBufferInfo() {{{2
|
" Function: s:svnFunctions.GetBufferInfo() {{{2
|
||||||
@ -189,7 +184,7 @@ endfunction
|
|||||||
function! s:svnFunctions.GetBufferInfo()
|
function! s:svnFunctions.GetBufferInfo()
|
||||||
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
let fileName = bufname(originalBuffer)
|
let fileName = bufname(originalBuffer)
|
||||||
let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status -vu "' . fileName . '"')
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -v -- "' . fileName . '"')
|
||||||
if(v:shell_error)
|
if(v:shell_error)
|
||||||
return []
|
return []
|
||||||
endif
|
endif
|
||||||
@ -199,12 +194,14 @@ function! s:svnFunctions.GetBufferInfo()
|
|||||||
return ['Unknown']
|
return ['Unknown']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
|
let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
|
||||||
if revision == ''
|
if revision == ''
|
||||||
" Error
|
" Error
|
||||||
return ['Unknown']
|
return ['Unknown']
|
||||||
elseif flags =~ '^A'
|
elseif flags =~ '^A'
|
||||||
return ['New', 'New']
|
return ['New', 'New']
|
||||||
|
elseif flags =~ '*'
|
||||||
|
return [revision, repository, '*']
|
||||||
else
|
else
|
||||||
return [revision, repository]
|
return [revision, repository]
|
||||||
endif
|
endif
|
||||||
@ -212,12 +209,12 @@ endfunction
|
|||||||
|
|
||||||
" Function: s:svnFunctions.Info(argList) {{{2
|
" Function: s:svnFunctions.Info(argList) {{{2
|
||||||
function! s:svnFunctions.Info(argList)
|
function! s:svnFunctions.Info(argList)
|
||||||
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
return s:DoCommand(join(['info --non-interactive'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Lock(argList) {{{2
|
" Function: s:svnFunctions.Lock(argList) {{{2
|
||||||
function! s:svnFunctions.Lock(argList)
|
function! s:svnFunctions.Lock(argList)
|
||||||
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
return s:DoCommand(join(['lock --non-interactive'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Log(argList) {{{2
|
" Function: s:svnFunctions.Log(argList) {{{2
|
||||||
@ -234,7 +231,7 @@ function! s:svnFunctions.Log(argList)
|
|||||||
let caption = join(a:argList, ' ')
|
let caption = join(a:argList, ' ')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand(join(['log', '-v'] + options), 'log', caption, {})
|
let resultBuffer = s:DoCommand(join(['log --non-interactive', '-v'] + options), 'log', caption, {})
|
||||||
return resultBuffer
|
return resultBuffer
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -253,32 +250,32 @@ function! s:svnFunctions.Review(argList)
|
|||||||
let versionOption = ' -r ' . versiontag . ' '
|
let versionOption = ' -r ' . versiontag . ' '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
|
return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {})
|
||||||
if resultBuffer > 0
|
|
||||||
let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
|
|
||||||
endif
|
|
||||||
return resultBuffer
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Status(argList) {{{2
|
" Function: s:svnFunctions.Status(argList) {{{2
|
||||||
function! s:svnFunctions.Status(argList)
|
function! s:svnFunctions.Status(argList)
|
||||||
let options = ['-u', '-v']
|
let options = ['-u', '-v']
|
||||||
if len(a:argList) == 0
|
if len(a:argList) != 0
|
||||||
let options = a:argList
|
let options = a:argList
|
||||||
endif
|
endif
|
||||||
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Unlock(argList) {{{2
|
" Function: s:svnFunctions.Unlock(argList) {{{2
|
||||||
function! s:svnFunctions.Unlock(argList)
|
function! s:svnFunctions.Unlock(argList)
|
||||||
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Function: s:svnFunctions.Update(argList) {{{2
|
" Function: s:svnFunctions.Update(argList) {{{2
|
||||||
function! s:svnFunctions.Update(argList)
|
function! s:svnFunctions.Update(argList)
|
||||||
return s:DoCommand('update', 'update', '', {})
|
return s:DoCommand('update --non-interactive', 'update', '', {})
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
|
||||||
|
|
||||||
" Section: Plugin Registration {{{1
|
" Section: Plugin Registration {{{1
|
||||||
call VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
|
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
|
45
.vim/syntax/cvsannotate.vim
Normal file
45
.vim/syntax/cvsannotate.vim
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: CVS annotate output
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" Remark: Used by the cvscommand plugin. Originally written by Mathieu
|
||||||
|
" Clabaut
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match cvsDate /\d\d-...-\d\d/ contained
|
||||||
|
syn match cvsName /(\S* /hs=s+1,he=e-1 contained nextgroup=cvsDate
|
||||||
|
syn match cvsVer /^\d\+\(\.\d\+\)\+/ contained nextgroup=cvsName
|
||||||
|
syn region cvsHead start="^\d\+\.\d\+" end="):" contains=cvsVer,cvsName,cvsDate
|
||||||
|
|
||||||
|
if !exists("did_cvsannotate_syntax_inits")
|
||||||
|
let did_cvsannotate_syntax_inits = 1
|
||||||
|
hi link cvsDate Comment
|
||||||
|
hi link cvsName Type
|
||||||
|
hi link cvsVer Statement
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax="CVSAnnotate"
|
44
.vim/syntax/gitannotate.vim
Normal file
44
.vim/syntax/gitannotate.vim
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: git annotate output
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" Remark: Used by the vcscommand plugin.
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn region gitName start="(\@<=" end="\( \d\d\d\d-\)\@=" contained
|
||||||
|
syn match gitCommit /^\^\?\x\+/ contained
|
||||||
|
syn match gitDate /\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d/ contained
|
||||||
|
syn match gitLineNumber /\d\+)\@=/ contained
|
||||||
|
syn region gitAnnotation start="^" end=") " oneline keepend contains=gitCommit,gitLineNumber,gitDate,gitName
|
||||||
|
|
||||||
|
if !exists("did_gitannotate_syntax_inits")
|
||||||
|
let did_gitannotate_syntax_inits = 1
|
||||||
|
hi link gitName Type
|
||||||
|
hi link gitCommit Statement
|
||||||
|
hi link gitDate Comment
|
||||||
|
hi link gitLineNumber Label
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax="gitAnnotate"
|
40
.vim/syntax/hgannotate.vim
Normal file
40
.vim/syntax/hgannotate.vim
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: HG annotate output
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" Remark: Used by the vcscommand plugin.
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match hgVer /\d\+/ contained
|
||||||
|
syn match hgName /^\s*\S\+/ contained
|
||||||
|
syn match hgHead /^\s*\S\+\s\+\d\+:/ contains=hgVer,hgName
|
||||||
|
|
||||||
|
if !exists("did_hgannotate_syntax_inits")
|
||||||
|
let did_hgannotate_syntax_inits = 1
|
||||||
|
hi link hgName Type
|
||||||
|
hi link hgVer Statement
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax="hgAnnotate"
|
42
.vim/syntax/svkannotate.vim
Normal file
42
.vim/syntax/svkannotate.vim
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: SVK annotate output
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" Remark: Used by the vcscommand plugin.
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained
|
||||||
|
syn match svkName /(\s*\zs\S\+/ contained nextgroup=svkDate skipwhite
|
||||||
|
syn match svkVer /^\s*\d\+/ contained nextgroup=svkName skipwhite
|
||||||
|
syn region svkHead start=/^/ end="):" contains=svkVer,svkName,svkDate oneline
|
||||||
|
|
||||||
|
if !exists("did_svkannotate_syntax_inits")
|
||||||
|
let did_svkannotate_syntax_inits = 1
|
||||||
|
hi link svkName Type
|
||||||
|
hi link svkDate Comment
|
||||||
|
hi link svkVer Statement
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax="svkAnnotate"
|
40
.vim/syntax/svnannotate.vim
Normal file
40
.vim/syntax/svnannotate.vim
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: SVN annotate output
|
||||||
|
" Maintainer: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
" Remark: Used by the vcscommand plugin.
|
||||||
|
" License:
|
||||||
|
" Copyright (c) Bob Hiestand
|
||||||
|
"
|
||||||
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
" deal in the Software without restriction, including without limitation the
|
||||||
|
" rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
" sell copies of the Software, and to permit persons to whom the Software is
|
||||||
|
" furnished to do so, subject to the following conditions:
|
||||||
|
"
|
||||||
|
" The above copyright notice and this permission notice shall be included in
|
||||||
|
" all copies or substantial portions of the Software.
|
||||||
|
"
|
||||||
|
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||||
|
" IN THE SOFTWARE.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syn match svnName /\S\+/ contained
|
||||||
|
syn match svnVer /^\s*\zs\d\+/ contained nextgroup=svnName skipwhite
|
||||||
|
syn match svnHead /^\s*\d\+\s\+\S\+/ contains=svnVer,svnName
|
||||||
|
|
||||||
|
if !exists("did_svnannotate_syntax_inits")
|
||||||
|
let did_svnannotate_syntax_inits = 1
|
||||||
|
hi link svnName Type
|
||||||
|
hi link svnVer Statement
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:current_syntax="svnAnnotate"
|
@ -2,7 +2,7 @@
|
|||||||
" Language: VCS commit file
|
" Language: VCS commit file
|
||||||
" Maintainer: Bob Hiestand (bob.hiestand@gmail.com)
|
" Maintainer: Bob Hiestand (bob.hiestand@gmail.com)
|
||||||
" License:
|
" License:
|
||||||
" Copyright (c) 2007 Bob Hiestand
|
" Copyright (c) Bob Hiestand
|
||||||
"
|
"
|
||||||
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
" Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
" of this software and associated documentation files (the "Software"), to
|
" of this software and associated documentation files (the "Software"), to
|
||||||
|
Loading…
Reference in New Issue
Block a user