+ vcscommand
git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@205 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
parent
3da9a9e4ac
commit
19997f3167
@ -34,3 +34,5 @@ ScriptID SourceID Filename
|
|||||||
1075 15782 :AutoInstall: netrw.vim
|
1075 15782 :AutoInstall: netrw.vim
|
||||||
1502 15362 :AutoInstall: vimball.vim
|
1502 15362 :AutoInstall: vimball.vim
|
||||||
3304 16172 Gundo
|
3304 16172 Gundo
|
||||||
|
90 15797 vcscommand
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
:CVSEdit vcscommand.txt /*:CVSEdit*
|
||||||
|
:CVSEditors vcscommand.txt /*:CVSEditors*
|
||||||
|
:CVSUnedit vcscommand.txt /*:CVSUnedit*
|
||||||
|
:CVSWatch vcscommand.txt /*:CVSWatch*
|
||||||
|
:CVSWatchAdd vcscommand.txt /*:CVSWatchAdd*
|
||||||
|
:CVSWatchOff vcscommand.txt /*:CVSWatchOff*
|
||||||
|
:CVSWatchOn vcscommand.txt /*:CVSWatchOn*
|
||||||
|
:CVSWatchRemove vcscommand.txt /*:CVSWatchRemove*
|
||||||
|
:CVSWatchers vcscommand.txt /*:CVSWatchers*
|
||||||
:Explore pi_netrw.txt /*:Explore*
|
:Explore pi_netrw.txt /*:Explore*
|
||||||
:GLVS pi_getscript.txt /*:GLVS*
|
:GLVS pi_getscript.txt /*:GLVS*
|
||||||
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
|
:GetLatestVimScripts_dat pi_getscript.txt /*:GetLatestVimScripts_dat*
|
||||||
@ -51,6 +60,23 @@
|
|||||||
:TCommentRight tcomment.txt /*:TCommentRight*
|
:TCommentRight tcomment.txt /*:TCommentRight*
|
||||||
:Texplore pi_netrw.txt /*:Texplore*
|
:Texplore pi_netrw.txt /*:Texplore*
|
||||||
:UseVimball pi_vimball.txt /*:UseVimball*
|
:UseVimball pi_vimball.txt /*:UseVimball*
|
||||||
|
:VCSAdd vcscommand.txt /*:VCSAdd*
|
||||||
|
:VCSAnnotate vcscommand.txt /*:VCSAnnotate*
|
||||||
|
:VCSBlame vcscommand.txt /*:VCSBlame*
|
||||||
|
:VCSCommit vcscommand.txt /*:VCSCommit*
|
||||||
|
:VCSDelete vcscommand.txt /*:VCSDelete*
|
||||||
|
:VCSDiff vcscommand.txt /*:VCSDiff*
|
||||||
|
:VCSGotoOriginal vcscommand.txt /*:VCSGotoOriginal*
|
||||||
|
:VCSInfo vcscommand.txt /*:VCSInfo*
|
||||||
|
:VCSLock vcscommand.txt /*:VCSLock*
|
||||||
|
:VCSLog vcscommand.txt /*:VCSLog*
|
||||||
|
:VCSRemove vcscommand.txt /*:VCSRemove*
|
||||||
|
:VCSRevert vcscommand.txt /*:VCSRevert*
|
||||||
|
:VCSReview vcscommand.txt /*:VCSReview*
|
||||||
|
:VCSStatus vcscommand.txt /*:VCSStatus*
|
||||||
|
:VCSUnlock vcscommand.txt /*:VCSUnlock*
|
||||||
|
:VCSUpdate vcscommand.txt /*:VCSUpdate*
|
||||||
|
:VCSVimDiff vcscommand.txt /*:VCSVimDiff*
|
||||||
:Vexplore pi_netrw.txt /*:Vexplore*
|
:Vexplore pi_netrw.txt /*:Vexplore*
|
||||||
:VimballList pi_vimball.txt /*:VimballList*
|
:VimballList pi_vimball.txt /*:VimballList*
|
||||||
Align-copyright Align.txt /*Align-copyright*
|
Align-copyright Align.txt /*Align-copyright*
|
||||||
@ -86,6 +112,29 @@ SRHiGrp SrchRplcHiGrp.txt /*SRHiGrp*
|
|||||||
SRSearch SrchRplcHiGrp.txt /*SRSearch*
|
SRSearch SrchRplcHiGrp.txt /*SRSearch*
|
||||||
SrchRplcHiGrp.txt SrchRplcHiGrp.txt /*SrchRplcHiGrp.txt*
|
SrchRplcHiGrp.txt SrchRplcHiGrp.txt /*SrchRplcHiGrp.txt*
|
||||||
TCommentDefineType() tComment.txt /*TCommentDefineType()*
|
TCommentDefineType() tComment.txt /*TCommentDefineType()*
|
||||||
|
VCSCommandCVSDiffOpt vcscommand.txt /*VCSCommandCVSDiffOpt*
|
||||||
|
VCSCommandCVSExec vcscommand.txt /*VCSCommandCVSExec*
|
||||||
|
VCSCommandCommitOnWrite vcscommand.txt /*VCSCommandCommitOnWrite*
|
||||||
|
VCSCommandDeleteOnHide vcscommand.txt /*VCSCommandDeleteOnHide*
|
||||||
|
VCSCommandDiffSplit vcscommand.txt /*VCSCommandDiffSplit*
|
||||||
|
VCSCommandDisableAll vcscommand.txt /*VCSCommandDisableAll*
|
||||||
|
VCSCommandDisableExtensionMappings vcscommand.txt /*VCSCommandDisableExtensionMappings*
|
||||||
|
VCSCommandDisableMappings vcscommand.txt /*VCSCommandDisableMappings*
|
||||||
|
VCSCommandDisableMenu vcscommand.txt /*VCSCommandDisableMenu*
|
||||||
|
VCSCommandEdit vcscommand.txt /*VCSCommandEdit*
|
||||||
|
VCSCommandEnableBufferSetup vcscommand.txt /*VCSCommandEnableBufferSetup*
|
||||||
|
VCSCommandMapPrefix vcscommand.txt /*VCSCommandMapPrefix*
|
||||||
|
VCSCommandMappings vcscommand.txt /*VCSCommandMappings*
|
||||||
|
VCSCommandMenuPriority vcscommand.txt /*VCSCommandMenuPriority*
|
||||||
|
VCSCommandMenuRoot vcscommand.txt /*VCSCommandMenuRoot*
|
||||||
|
VCSCommandResultBufferNameExtension vcscommand.txt /*VCSCommandResultBufferNameExtension*
|
||||||
|
VCSCommandResultBufferNameFunction vcscommand.txt /*VCSCommandResultBufferNameFunction*
|
||||||
|
VCSCommandSVKExec vcscommand.txt /*VCSCommandSVKExec*
|
||||||
|
VCSCommandSVNDiffExt vcscommand.txt /*VCSCommandSVNDiffExt*
|
||||||
|
VCSCommandSVNDiffOpt vcscommand.txt /*VCSCommandSVNDiffOpt*
|
||||||
|
VCSCommandSVNExec vcscommand.txt /*VCSCommandSVNExec*
|
||||||
|
VCSCommandSplit vcscommand.txt /*VCSCommandSplit*
|
||||||
|
VCSCommandVCSTypeOverride vcscommand.txt /*VCSCommandVCSTypeOverride*
|
||||||
VimPdb.txt VimPdb.txt /*VimPdb.txt*
|
VimPdb.txt VimPdb.txt /*VimPdb.txt*
|
||||||
Vimball-copyright pi_vimball.txt /*Vimball-copyright*
|
Vimball-copyright pi_vimball.txt /*Vimball-copyright*
|
||||||
[% matchit.txt /*[%*
|
[% matchit.txt /*[%*
|
||||||
@ -174,6 +223,10 @@ alignmap-tt Align.txt /*alignmap-tt*
|
|||||||
alignmap-t~ Align.txt /*alignmap-t~*
|
alignmap-t~ Align.txt /*alignmap-t~*
|
||||||
alignmaps Align.txt /*alignmaps*
|
alignmaps Align.txt /*alignmaps*
|
||||||
alignusage Align.txt /*alignusage*
|
alignusage Align.txt /*alignusage*
|
||||||
|
b:VCSCommandCommand vcscommand.txt /*b:VCSCommandCommand*
|
||||||
|
b:VCSCommandOriginalBuffer vcscommand.txt /*b:VCSCommandOriginalBuffer*
|
||||||
|
b:VCSCommandSourceFile vcscommand.txt /*b:VCSCommandSourceFile*
|
||||||
|
b:VCSCommandVCSType vcscommand.txt /*b:VCSCommandVCSType*
|
||||||
b:match_col matchit.txt /*b:match_col*
|
b:match_col matchit.txt /*b:match_col*
|
||||||
b:match_debug matchit.txt /*b:match_debug*
|
b:match_debug matchit.txt /*b:match_debug*
|
||||||
b:match_ignorecase matchit.txt /*b:match_ignorecase*
|
b:match_ignorecase matchit.txt /*b:match_ignorecase*
|
||||||
@ -1427,6 +1480,7 @@ crvdoc-licGPL crefvimdoc.txt /*crvdoc-licGPL*
|
|||||||
crvdoc-licLGPL crefvimdoc.txt /*crvdoc-licLGPL*
|
crvdoc-licLGPL crefvimdoc.txt /*crvdoc-licLGPL*
|
||||||
crvdoc-limbugs crefvimdoc.txt /*crvdoc-limbugs*
|
crvdoc-limbugs crefvimdoc.txt /*crvdoc-limbugs*
|
||||||
crvdoc-usage crefvimdoc.txt /*crvdoc-usage*
|
crvdoc-usage crefvimdoc.txt /*crvdoc-usage*
|
||||||
|
cvscommand-changes vcscommand.txt /*cvscommand-changes*
|
||||||
dav pi_netrw.txt /*dav*
|
dav pi_netrw.txt /*dav*
|
||||||
davs pi_netrw.txt /*davs*
|
davs pi_netrw.txt /*davs*
|
||||||
drv-dtArrayInit crefvim.txt /*drv-dtArrayInit*
|
drv-dtArrayInit crefvim.txt /*drv-dtArrayInit*
|
||||||
@ -1836,6 +1890,29 @@ v_]% matchit.txt /*v_]%*
|
|||||||
v_a% matchit.txt /*v_a%*
|
v_a% matchit.txt /*v_a%*
|
||||||
v_g% matchit.txt /*v_g%*
|
v_g% matchit.txt /*v_g%*
|
||||||
vba pi_vimball.txt /*vba*
|
vba pi_vimball.txt /*vba*
|
||||||
|
vcscommand vcscommand.txt /*vcscommand*
|
||||||
|
vcscommand-buffer-management vcscommand.txt /*vcscommand-buffer-management*
|
||||||
|
vcscommand-buffer-variables vcscommand.txt /*vcscommand-buffer-variables*
|
||||||
|
vcscommand-bugs vcscommand.txt /*vcscommand-bugs*
|
||||||
|
vcscommand-commands vcscommand.txt /*vcscommand-commands*
|
||||||
|
vcscommand-config vcscommand.txt /*vcscommand-config*
|
||||||
|
vcscommand-contents vcscommand.txt /*vcscommand-contents*
|
||||||
|
vcscommand-customize vcscommand.txt /*vcscommand-customize*
|
||||||
|
vcscommand-events vcscommand.txt /*vcscommand-events*
|
||||||
|
vcscommand-install vcscommand.txt /*vcscommand-install*
|
||||||
|
vcscommand-intro vcscommand.txt /*vcscommand-intro*
|
||||||
|
vcscommand-manual vcscommand.txt /*vcscommand-manual*
|
||||||
|
vcscommand-mappings vcscommand.txt /*vcscommand-mappings*
|
||||||
|
vcscommand-mappings-override vcscommand.txt /*vcscommand-mappings-override*
|
||||||
|
vcscommand-naming vcscommand.txt /*vcscommand-naming*
|
||||||
|
vcscommand-options vcscommand.txt /*vcscommand-options*
|
||||||
|
vcscommand-ssh vcscommand.txt /*vcscommand-ssh*
|
||||||
|
vcscommand-ssh-config vcscommand.txt /*vcscommand-ssh-config*
|
||||||
|
vcscommand-ssh-env vcscommand.txt /*vcscommand-ssh-env*
|
||||||
|
vcscommand-ssh-other vcscommand.txt /*vcscommand-ssh-other*
|
||||||
|
vcscommand-ssh-wrapper vcscommand.txt /*vcscommand-ssh-wrapper*
|
||||||
|
vcscommand-statusline vcscommand.txt /*vcscommand-statusline*
|
||||||
|
vcscommand.txt vcscommand.txt /*vcscommand.txt*
|
||||||
vimball pi_vimball.txt /*vimball*
|
vimball pi_vimball.txt /*vimball*
|
||||||
vimball-contents pi_vimball.txt /*vimball-contents*
|
vimball-contents pi_vimball.txt /*vimball-contents*
|
||||||
vimball-extract pi_vimball.txt /*vimball-extract*
|
vimball-extract pi_vimball.txt /*vimball-extract*
|
||||||
|
835
vimfiles/doc/vcscommand.txt
Normal file
835
vimfiles/doc/vcscommand.txt
Normal file
@ -0,0 +1,835 @@
|
|||||||
|
*vcscommand.txt* vcscommand
|
||||||
|
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.
|
||||||
|
|
||||||
|
For instructions on installing this file, type
|
||||||
|
:help add-local-help
|
||||||
|
inside Vim.
|
||||||
|
|
||||||
|
Author: Bob Hiestand <bob.hiestand@gmail.com>
|
||||||
|
Credits: Benji Fisher's excellent MatchIt documentation
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
1. Contents *vcscommand-contents*
|
||||||
|
|
||||||
|
Installation : |vcscommand-install|
|
||||||
|
vcscommand Intro : |vcscommand|
|
||||||
|
vcscommand Manual : |vcscommand-manual|
|
||||||
|
Customization : |vcscommand-customize|
|
||||||
|
SSH "integration" : |vcscommand-ssh|
|
||||||
|
Changes from cvscommand : |cvscommand-changes|
|
||||||
|
Bugs : |vcscommand-bugs|
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
2. vcscommand Installation *vcscommand-install*
|
||||||
|
|
||||||
|
The vcscommand plugin comprises five files: vcscommand.vim, vcssvn.vim,
|
||||||
|
vcscvs.vim, vcssvk.vim and vcscommand.txt (this file). In order to install
|
||||||
|
the plugin, place the vcscommand.vim, vcssvn.vim, vcssvk.vim, and vcscvs.vim
|
||||||
|
files into a plugin directory in your runtime path (please see
|
||||||
|
|add-global-plugin| and |'runtimepath'|.
|
||||||
|
|
||||||
|
This help file can be included in the VIM help system by copying it into a
|
||||||
|
'doc' directory in your runtime path and then executing the |:helptags|
|
||||||
|
command, specifying the full path of the 'doc' directory. Please see
|
||||||
|
|add-local-help| for more details.
|
||||||
|
|
||||||
|
vcscommand may be customized by setting variables, creating maps, and
|
||||||
|
specifying event handlers. Please see |vcscommand-customize| for more
|
||||||
|
details.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
3. vcscommand Intro *vcscommand*
|
||||||
|
*vcscommand-intro*
|
||||||
|
|
||||||
|
The vcscommand plugin provides global ex commands for manipulating
|
||||||
|
version-controlled source files, currently those controlled either by CVS or
|
||||||
|
Subversion. In general, each command operates on the current buffer and
|
||||||
|
accomplishes a separate source control function, such as update, commit, log,
|
||||||
|
and others (please see |vcscommand-commands| for a list of all available
|
||||||
|
commands). The results of each operation are displayed in a scratch buffer.
|
||||||
|
Several buffer variables are defined for those scratch buffers (please see
|
||||||
|
|vcscommand-buffer-variables|).
|
||||||
|
|
||||||
|
The notion of "current file" means either the current buffer, or, in the case
|
||||||
|
of a directory buffer (such as Explorer or netrw buffers), the directory (and
|
||||||
|
all subdirectories) represented by the the buffer.
|
||||||
|
|
||||||
|
For convenience, any vcscommand invoked on a vcscommand scratch buffer acts as
|
||||||
|
though it was invoked on the original file and splits the screen so that the
|
||||||
|
output appears in a new window.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Each vcscommand is mapped to a key sequence starting with the |<Leader>|
|
||||||
|
keystroke. The default mappings may be overridden by supplying different
|
||||||
|
mappings before the plugin is loaded, such as in the vimrc, in the standard
|
||||||
|
fashion for plugin mappings. For examples, please see
|
||||||
|
|vcscommand-mappings-override|.
|
||||||
|
|
||||||
|
The vcscommand plugin may be configured in several ways. For more details,
|
||||||
|
please see |vcscommand-customize|.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
4. vcscommand Manual *vcscommand-manual*
|
||||||
|
|
||||||
|
4.1 vcscommand commands *vcscommand-commands*
|
||||||
|
|
||||||
|
vcscommand defines the following commands:
|
||||||
|
|
||||||
|
|:VCSAdd|
|
||||||
|
|:VCSAnnotate|
|
||||||
|
|:VCSBlame|
|
||||||
|
|:VCSCommit|
|
||||||
|
|:VCSDelete|
|
||||||
|
|:VCSDiff|
|
||||||
|
|:VCSGotoOriginal|
|
||||||
|
|:VCSLog|
|
||||||
|
|:VCSRemove|
|
||||||
|
|:VCSRevert|
|
||||||
|
|:VCSReview|
|
||||||
|
|:VCSStatus|
|
||||||
|
|:VCSUpdate|
|
||||||
|
|:VCSVimDiff|
|
||||||
|
|
||||||
|
The following commands are specific to CVS files:
|
||||||
|
|
||||||
|
|:CVSEdit|
|
||||||
|
|:CVSEditors|
|
||||||
|
|:CVSUnedit|
|
||||||
|
|:CVSWatch|
|
||||||
|
|:CVSWatchAdd|
|
||||||
|
|:CVSWatchOn|
|
||||||
|
|:CVSWatchOff|
|
||||||
|
|:CVSWatchRemove|
|
||||||
|
|:CVSWatchers|
|
||||||
|
|
||||||
|
:VCSAdd *:VCSAdd*
|
||||||
|
|
||||||
|
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
|
||||||
|
the underlying VCS.
|
||||||
|
|
||||||
|
:VCSAnnotate[!] *:VCSAnnotate*
|
||||||
|
|
||||||
|
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
|
||||||
|
argument is used as a revision number to display. If not given an argument,
|
||||||
|
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
|
||||||
|
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,
|
||||||
|
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
|
||||||
|
necessary.
|
||||||
|
|
||||||
|
With no arguments the cursor will jump to the line in the annotated buffer
|
||||||
|
corresponding to the current line in the source buffer.
|
||||||
|
|
||||||
|
:VCSBlame[!] *:VCSBlame*
|
||||||
|
|
||||||
|
Alias for |:VCSAnnotate|.
|
||||||
|
|
||||||
|
:VCSCommit[!] *:VCSCommit*
|
||||||
|
|
||||||
|
This command commits changes to the current file to source control.
|
||||||
|
|
||||||
|
If called with arguments, the arguments are the log message.
|
||||||
|
|
||||||
|
If '!' is used, an empty log message is committed.
|
||||||
|
|
||||||
|
If called with no arguments, this is a two-step command. The first step opens
|
||||||
|
a buffer to accept a log message. When that buffer is written, it is
|
||||||
|
automatically closed and the file is committed using the information from that
|
||||||
|
log message. The commit can be abandoned if the log message buffer is deleted
|
||||||
|
or wiped before being written.
|
||||||
|
|
||||||
|
Alternatively, the mapping that is used to invoke :VCSCommit (by default
|
||||||
|
|<Leader>|cc, please see |vcscommand-mappings|) can be used in the log message
|
||||||
|
buffer in Normal mode to immediately commit. This is useful if the
|
||||||
|
|VCSCommandCommitOnWrite| variable is set to 0 to disable the normal
|
||||||
|
commit-on-write behavior.
|
||||||
|
|
||||||
|
:VCSDelete *:VCSDelete*
|
||||||
|
|
||||||
|
Deletes the current file and removes it from source control. All parameters
|
||||||
|
to the command are passed to the underlying VCS.
|
||||||
|
|
||||||
|
:VCSDiff *:VCSDiff*
|
||||||
|
|
||||||
|
With no arguments, this displays the differences between the current file and
|
||||||
|
its parent version under source control in a new scratch buffer.
|
||||||
|
|
||||||
|
With one argument, the diff is performed on the current file against the
|
||||||
|
specified revision.
|
||||||
|
|
||||||
|
With two arguments, the diff is performed between the specified revisions of
|
||||||
|
the current file.
|
||||||
|
|
||||||
|
For CVS, this command uses the |VCSCommandCVSDiffOpt| variable to specify diff
|
||||||
|
options. If that variable does not exist, a plugin-specific default is used.
|
||||||
|
If you wish to have no options, then set it to the empty string.
|
||||||
|
|
||||||
|
For SVN, this command uses the |VCSCommandSVNDiffOpt| variable to specify diff
|
||||||
|
options. If that variable does not exist, the SVN default is used.
|
||||||
|
Additionally, |VCSCommandSVNDiffExt| can be used to select an external diff
|
||||||
|
application.
|
||||||
|
|
||||||
|
:VCSGotoOriginal *:VCSGotoOriginal*
|
||||||
|
|
||||||
|
This command jumps to the source buffer if the current buffer is a VCS scratch
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
:VCSGotoOriginal!
|
||||||
|
|
||||||
|
Like ":VCSGotoOriginal" but also executes :bufwipeout on all VCS scrach
|
||||||
|
buffers associated with the original file.
|
||||||
|
|
||||||
|
:VCSInfo *:VCSInfo*
|
||||||
|
|
||||||
|
This command displays extended information about the current file in a new
|
||||||
|
scratch buffer.
|
||||||
|
|
||||||
|
:VCSLock *:VCSLock*
|
||||||
|
|
||||||
|
This command locks the current file in order to prevent other users from
|
||||||
|
concurrently modifying it. The exact semantics of this command depend on the
|
||||||
|
underlying VCS. This does nothing in CVS. All parameters are passed to the
|
||||||
|
underlying VCS.
|
||||||
|
|
||||||
|
:VCSLog *:VCSLog*
|
||||||
|
|
||||||
|
Displays the version history of the current file in a new scratch buffer. If
|
||||||
|
there is one parameter supplied, it is taken as as a revision parameters to be
|
||||||
|
passed through to the underlying VCS. Otherwise, all parameters are passed to
|
||||||
|
the underlying VCS.
|
||||||
|
|
||||||
|
:VCSRemove *:VCSRemove*
|
||||||
|
|
||||||
|
Alias for |:VCSDelete|.
|
||||||
|
|
||||||
|
:VCSRevert *:VCSRevert*
|
||||||
|
|
||||||
|
This command replaces the current file with the most recent version from the
|
||||||
|
repository in order to wipe out any undesired changes.
|
||||||
|
|
||||||
|
:VCSReview *:VCSReview*
|
||||||
|
|
||||||
|
Displays a particular version of the current file in a new scratch buffer. If
|
||||||
|
no argument is given, the most recent version of the file on the current
|
||||||
|
branch is retrieved.
|
||||||
|
|
||||||
|
:VCSStatus *:VCSStatus*
|
||||||
|
|
||||||
|
Displays versioning information about the current file in a new scratch
|
||||||
|
buffer. All parameters are passed to the underlying VCS.
|
||||||
|
|
||||||
|
|
||||||
|
:VCSUnlock *:VCSUnlock*
|
||||||
|
|
||||||
|
Unlocks the current file in order to allow other users from concurrently
|
||||||
|
modifying it. The exact semantics of this command depend on the underlying
|
||||||
|
VCS. All parameters are passed to the underlying VCS.
|
||||||
|
|
||||||
|
:VCSUpdate *:VCSUpdate*
|
||||||
|
|
||||||
|
Updates the current file with any relevant changes from the repository. This
|
||||||
|
intentionally does not automatically reload the current buffer, though vim
|
||||||
|
should prompt the user to do so if the underlying file is altered by this
|
||||||
|
command.
|
||||||
|
|
||||||
|
:VCSVimDiff *:VCSVimDiff*
|
||||||
|
|
||||||
|
Uses vimdiff to display differences between versions of the current file.
|
||||||
|
|
||||||
|
If no revision is specified, the most recent version of the file on the
|
||||||
|
current branch is used. With one argument, that argument is used as the
|
||||||
|
revision as above. With two arguments, the differences between the two
|
||||||
|
revisions is displayed using vimdiff.
|
||||||
|
|
||||||
|
With either zero or one argument, the original buffer is used to perform the
|
||||||
|
vimdiff. When the scratch buffer is closed, the original buffer will be
|
||||||
|
returned to normal mode.
|
||||||
|
|
||||||
|
Once vimdiff mode is started using the above methods, additional vimdiff
|
||||||
|
buffers may be added by passing a single version argument to the command.
|
||||||
|
There may be up to 4 vimdiff buffers total.
|
||||||
|
|
||||||
|
Using the 2-argument form of the command resets the vimdiff to only those 2
|
||||||
|
versions. Additionally, invoking the command on a different file will close
|
||||||
|
the previous vimdiff buffers.
|
||||||
|
|
||||||
|
:CVSEdit *:CVSEdit*
|
||||||
|
|
||||||
|
This command performs "cvs edit" on the current file. Yes, the output buffer
|
||||||
|
in this case is almost completely useless.
|
||||||
|
|
||||||
|
:CVSEditors *:CVSEditors*
|
||||||
|
|
||||||
|
This command performs "cvs edit" on the current file.
|
||||||
|
|
||||||
|
:CVSUnedit *:CVSUnedit*
|
||||||
|
|
||||||
|
Performs "cvs unedit" on the current file. Again, yes, the output buffer here
|
||||||
|
is basically useless.
|
||||||
|
|
||||||
|
:CVSWatch *:CVSWatch*
|
||||||
|
|
||||||
|
This command takes an argument which must be one of [on|off|add|remove]. The
|
||||||
|
command performs "cvs watch" with the given argument on the current file.
|
||||||
|
|
||||||
|
:CVSWatchAdd *:CVSWatchAdd*
|
||||||
|
|
||||||
|
This command is an alias for ":CVSWatch add"
|
||||||
|
|
||||||
|
:CVSWatchOn *:CVSWatchOn*
|
||||||
|
|
||||||
|
This command is an alias for ":CVSWatch on"
|
||||||
|
|
||||||
|
:CVSWatchOff *:CVSWatchOff*
|
||||||
|
|
||||||
|
This command is an alias for ":CVSWatch off"
|
||||||
|
|
||||||
|
:CVSWatchRemove *:CVSWatchRemove*
|
||||||
|
|
||||||
|
This command is an alias for ":CVSWatch remove"
|
||||||
|
|
||||||
|
:CVSWatchers *:CVSWatchers*
|
||||||
|
|
||||||
|
This command performs "cvs watchers" on the current file.
|
||||||
|
|
||||||
|
4.2 Mappings *vcscommand-mappings*
|
||||||
|
|
||||||
|
By default, a mapping is defined for each command. These mappings execute the
|
||||||
|
default (no-argument) form of each command.
|
||||||
|
|
||||||
|
|<Leader>|ca VCSAdd
|
||||||
|
|<Leader>|cn VCSAnnotate
|
||||||
|
|<Leader>|cN VCSAnnotate!
|
||||||
|
|<Leader>|cc VCSCommit
|
||||||
|
|<Leader>|cD VCSDelete
|
||||||
|
|<Leader>|cd VCSDiff
|
||||||
|
|<Leader>|cg VCSGotoOriginal
|
||||||
|
|<Leader>|cG VCSGotoOriginal!
|
||||||
|
|<Leader>|ci VCSInfo
|
||||||
|
|<Leader>|cl VCSLog
|
||||||
|
|<Leader>|cL VCSLock
|
||||||
|
|<Leader>|cr VCSReview
|
||||||
|
|<Leader>|cs VCSStatus
|
||||||
|
|<Leader>|cu VCSUpdate
|
||||||
|
|<Leader>|cU VCSUnlock
|
||||||
|
|<Leader>|cv VCSVimDiff
|
||||||
|
|
||||||
|
Only for CVS buffers:
|
||||||
|
|
||||||
|
|<Leader>|ce CVSEdit
|
||||||
|
|<Leader>|cE CVSEditors
|
||||||
|
|<Leader>|ct CVSUnedit
|
||||||
|
|<Leader>|cwv CVSWatchers
|
||||||
|
|<Leader>|cwa CVSWatchAdd
|
||||||
|
|<Leader>|cwn CVSWatchOn
|
||||||
|
|<Leader>|cwf CVSWatchOff
|
||||||
|
|<Leader>|cwf CVSWatchRemove
|
||||||
|
|
||||||
|
*vcscommand-mappings-override*
|
||||||
|
|
||||||
|
The default mappings can be overridden by user-provided instead by mapping to
|
||||||
|
<Plug>CommandName. This is especially useful when these mappings collide with
|
||||||
|
other existing mappings (vim will warn of this during plugin initialization,
|
||||||
|
but will not clobber the existing mappings).
|
||||||
|
|
||||||
|
There are three methods for controlling mapping:
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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*
|
||||||
|
|
||||||
|
Several buffer variables are defined in each vcscommand result buffer. These
|
||||||
|
may be useful for additional customization in callbacks defined in the event
|
||||||
|
handlers (please see |vcscommand-events|).
|
||||||
|
|
||||||
|
The following variables are automatically defined:
|
||||||
|
|
||||||
|
b:VCSCommandOriginalBuffer *b:VCSCommandOriginalBuffer*
|
||||||
|
|
||||||
|
This variable is set to the buffer number of the source file.
|
||||||
|
|
||||||
|
b:VCSCommandCommand *b:VCSCommandCommand*
|
||||||
|
|
||||||
|
This variable is set to the name of the vcscommand that created the result
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
b:VCSCommandSourceFile *b:VCSCommandSourceFile*
|
||||||
|
|
||||||
|
This variable is set to the name of the original file under source control.
|
||||||
|
|
||||||
|
b:VCSCommandVCSType *b:VCSCommandVCSType*
|
||||||
|
|
||||||
|
This variable is set to the type of the source control. This variable is also
|
||||||
|
set on the original file itself.
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
5. Configuration and customization *vcscommand-customize*
|
||||||
|
*vcscommand-config*
|
||||||
|
|
||||||
|
The vcscommand plugin can be configured in several ways: by setting
|
||||||
|
configuration variables (see |vcscommand-options|) or by defining vcscommand
|
||||||
|
event handlers (see |vcscommand-events|). Additionally, the vcscommand plugin
|
||||||
|
supports a customized status line (see |vcscommand-statusline| and
|
||||||
|
|vcscommand-buffer-management|).
|
||||||
|
|
||||||
|
5.1 vcscommand configuration variables *vcscommand-options*
|
||||||
|
|
||||||
|
Several variables affect the plugin's behavior. These variables are checked
|
||||||
|
at time of execution, and may be defined at the window, buffer, or global
|
||||||
|
level and are checked in that order of precedence.
|
||||||
|
|
||||||
|
|
||||||
|
The following variables are available:
|
||||||
|
|
||||||
|
|VCSCommandCommitOnWrite|
|
||||||
|
|VCSCommandCVSDiffOpt|
|
||||||
|
|VCSCommandCVSExec|
|
||||||
|
|VCSCommandDeleteOnHide|
|
||||||
|
|VCSCommandDiffSplit|
|
||||||
|
|VCSCommandDisableAll|
|
||||||
|
|VCSCommandDisableMappings|
|
||||||
|
|VCSCommandDisableExtensionMappings|
|
||||||
|
|VCSCommandDisableMenu|
|
||||||
|
|VCSCommandEdit|
|
||||||
|
|VCSCommandEnableBufferSetup|
|
||||||
|
|VCSCommandMappings|
|
||||||
|
|VCSCommandMapPrefix|
|
||||||
|
|VCSCommandMenuPriority|
|
||||||
|
|VCSCommandMenuRoot|
|
||||||
|
|VCSCommandResultBufferNameExtension|
|
||||||
|
|VCSCommandResultBufferNameFunction|
|
||||||
|
|VCSCommandSplit|
|
||||||
|
|VCSCommandSVKExec|
|
||||||
|
|VCSCommandSVNDiffExt|
|
||||||
|
|VCSCommandSVNDiffOpt|
|
||||||
|
|VCSCommandSVNExec|
|
||||||
|
|VCSCommandVCSTypeOverride|
|
||||||
|
|
||||||
|
VCSCommandCommitOnWrite *VCSCommandCommitOnWrite*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, causes the pending commit
|
||||||
|
to take place immediately as soon as the log message buffer is written.
|
||||||
|
If set to zero, only the VCSCommit mapping will cause the pending commit to
|
||||||
|
occur. If not set, it defaults to 1.
|
||||||
|
|
||||||
|
VCSCommandCVSExec *VCSCommandCVSExec*
|
||||||
|
|
||||||
|
This variable controls the executable used for all CVS commands If not set,
|
||||||
|
it defaults to "cvs".
|
||||||
|
|
||||||
|
VCSCommandDeleteOnHide *VCSCommandDeleteOnHide*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, causes the temporary result buffers
|
||||||
|
to automatically delete themselves when hidden.
|
||||||
|
|
||||||
|
VCSCommandCVSDiffOpt *VCSCommandCVSDiffOpt*
|
||||||
|
|
||||||
|
This variable, if set, determines the options passed to the diff command of
|
||||||
|
CVS. If not set, it defaults to 'u'.
|
||||||
|
|
||||||
|
VCSCommandDiffSplit *VCSCommandDiffSplit*
|
||||||
|
|
||||||
|
This variable overrides the |VCSCommandSplit| variable, but only for buffers
|
||||||
|
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*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, prevents the default command
|
||||||
|
mappings from being set. This supercedes
|
||||||
|
|VCSCommandDisableExtensionMappings|.
|
||||||
|
|
||||||
|
VCSCommandDisableExtensionMappings *VCSCommandDisableExtensionMappings*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, prevents the default command
|
||||||
|
mappings from being set for commands specific to an individual VCS.
|
||||||
|
|
||||||
|
VCSCommandEdit *VCSCommandEdit*
|
||||||
|
|
||||||
|
This variable controls whether the original buffer is replaced ('edit') or
|
||||||
|
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*
|
||||||
|
|
||||||
|
This variable, if set to a non-zero value, activates VCS buffer management
|
||||||
|
mode see (|vcscommand-buffer-management|). This mode means that the
|
||||||
|
'VCSCommandBufferInfo' variable is filled with version information if the file
|
||||||
|
is VCS-controlled. This is useful for displaying version information in the
|
||||||
|
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*
|
||||||
|
|
||||||
|
This variable, if set to a non-blank value, is appended to the name of the VCS
|
||||||
|
command output buffers. For example, '.vcs'. Using this option may help
|
||||||
|
avoid problems caused by autocommands dependent on file extension.
|
||||||
|
|
||||||
|
VCSCommandResultBufferNameFunction *VCSCommandResultBufferNameFunction*
|
||||||
|
|
||||||
|
This variable, if set, specifies a custom function for naming VCS command
|
||||||
|
output buffers. This function is expected to return the new buffer name, and
|
||||||
|
will be passed the following arguments:
|
||||||
|
|
||||||
|
command - name of the VCS command being executed (such as 'Log' or
|
||||||
|
'Diff').
|
||||||
|
|
||||||
|
originalBuffer - buffer number of the source file.
|
||||||
|
|
||||||
|
vcsType - type of VCS controlling this file (such as 'CVS' or 'SVN').
|
||||||
|
|
||||||
|
statusText - extra text associated with the VCS action (such as version
|
||||||
|
numbers).
|
||||||
|
|
||||||
|
VCSCommandSplit *VCSCommandSplit*
|
||||||
|
|
||||||
|
This variable controls the orientation of the various window splits that
|
||||||
|
may occur.
|
||||||
|
|
||||||
|
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
|
||||||
|
side-by-side. If not set, it defaults to 'horizontal' for all but
|
||||||
|
VCSVimDiff windows. VCSVimDiff windows default to the user's 'diffopt'
|
||||||
|
setting, if set, otherwise 'vertical'.
|
||||||
|
|
||||||
|
VCSCommandSVKExec *VCSCommandSVKExec*
|
||||||
|
|
||||||
|
This variable controls the executable used for all SVK commands If not set,
|
||||||
|
it defaults to "svk".
|
||||||
|
|
||||||
|
VCSCommandSVNDiffExt *VCSCommandSVNDiffExt*
|
||||||
|
|
||||||
|
This variable, if set, is passed to SVN via the --diff-cmd command to select
|
||||||
|
an external application for performing the diff.
|
||||||
|
|
||||||
|
VCSCommandSVNDiffOpt *VCSCommandSVNDiffOpt*
|
||||||
|
|
||||||
|
This variable, if set, determines the options passed with the '-x' parameter
|
||||||
|
to the SVN diff command. If not set, no options are passed.
|
||||||
|
|
||||||
|
VCSCommandSVNExec *VCSCommandSVNExec*
|
||||||
|
|
||||||
|
This variable controls the executable used for all SVN commands If not set,
|
||||||
|
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.
|
||||||
|
|
||||||
|
5.2 VCSCommand events *vcscommand-events*
|
||||||
|
|
||||||
|
For additional customization, vcscommand can trigger user-defined events.
|
||||||
|
Event handlers are provided by defining User event autocommands (see
|
||||||
|
|autocommand|, |User|) in the vcscommand group with patterns matching the
|
||||||
|
event name.
|
||||||
|
|
||||||
|
For instance, the following could be added to the vimrc to provide a 'q'
|
||||||
|
mapping to quit a vcscommand scratch buffer:
|
||||||
|
|
||||||
|
augroup VCSCommand
|
||||||
|
au User VCSBufferCreated silent! nmap <unique> <buffer> q :bwipeout<cr>
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
The following hooks are available:
|
||||||
|
|
||||||
|
VCSBufferCreated This event is fired just after a vcscommand
|
||||||
|
result buffer is created and populated. It is
|
||||||
|
executed within the context of the vcscommand
|
||||||
|
buffer. The vcscommand buffer variables may
|
||||||
|
be useful for handlers of this event (please
|
||||||
|
see |vcscommand-buffer-variables|).
|
||||||
|
|
||||||
|
VCSBufferSetup This event is fired just after vcscommand buffer
|
||||||
|
setup occurs, if enabled.
|
||||||
|
|
||||||
|
VCSPluginInit This event is fired when the vcscommand plugin
|
||||||
|
first loads.
|
||||||
|
|
||||||
|
VCSPluginFinish This event is fired just after the vcscommand
|
||||||
|
plugin loads.
|
||||||
|
|
||||||
|
VCSVimDiffFinish This event is fired just after the VCSVimDiff
|
||||||
|
command executes to allow customization of,
|
||||||
|
for instance, window placement and focus.
|
||||||
|
|
||||||
|
Additionally, there is another hook which is used internally to handle loading
|
||||||
|
the multiple scripts in order. This hook should probably not be used by an
|
||||||
|
end user without a good idea of how it works. Among other things, any events
|
||||||
|
associated with this hook are cleared after they are executed (during
|
||||||
|
vcscommand.vim script initialization).
|
||||||
|
|
||||||
|
VCSLoadExtensions This event is fired just before the
|
||||||
|
VCSPluginFinish. It is used internally to
|
||||||
|
execute any commands from the VCS
|
||||||
|
implementation plugins that needs to be
|
||||||
|
deferred until the primary plugin is
|
||||||
|
initialized.
|
||||||
|
|
||||||
|
5.3 vcscommand buffer naming *vcscommand-naming*
|
||||||
|
|
||||||
|
vcscommand result buffers use the following naming convention:
|
||||||
|
[{VCS type} {VCS command} {Source file name}]
|
||||||
|
|
||||||
|
If additional buffers are created that would otherwise conflict, a
|
||||||
|
distinguishing number is added:
|
||||||
|
|
||||||
|
[{VCS type} {VCS command} {Source file name}] (1,2, etc)
|
||||||
|
|
||||||
|
5.4 vcscommand status line support *vcscommand-statusline*
|
||||||
|
|
||||||
|
It is intended that the user will customize the |'statusline'| option to
|
||||||
|
include vcscommand result buffer attributes. A sample function that may be
|
||||||
|
used in the |'statusline'| option is provided by the plugin,
|
||||||
|
VCSCommandGetStatusLine(). In order to use that function in the status line, do
|
||||||
|
something like the following:
|
||||||
|
|
||||||
|
set statusline=%<%f\ %{VCSCommandGetStatusLine()}\ %h%m%r%=%l,%c%V\ %P
|
||||||
|
|
||||||
|
of which %{VCSCommandGetStatusLine()} is the relevant portion.
|
||||||
|
|
||||||
|
The sample VCSCommandGetStatusLine() function handles both vcscommand result
|
||||||
|
buffers and VCS-managed files if vcscommand buffer management is enabled
|
||||||
|
(please see |vcscommand-buffer-management|).
|
||||||
|
|
||||||
|
5.5 vcscommand buffer management *vcscommand-buffer-management*
|
||||||
|
|
||||||
|
The vcscommand plugin can operate in buffer management mode, which means that
|
||||||
|
it attempts to set a buffer variable ('VCSCommandBufferInfo') upon entry into
|
||||||
|
a buffer. This is rather slow because it means that the VCS will be invoked
|
||||||
|
at each entry into a buffer (during the |BufEnter| autocommand).
|
||||||
|
|
||||||
|
This mode is disabled by default. In order to enable it, set the
|
||||||
|
|VCSCommandEnableBufferSetup| variable to a true (non-zero) value. Enabling
|
||||||
|
this mode simply provides the buffer variable mentioned above. The user must
|
||||||
|
explicitly include information from the variable in the |'statusline'| option
|
||||||
|
if they are to appear in the status line (but see |vcscommand-statusline| for
|
||||||
|
a simple way to do that).
|
||||||
|
|
||||||
|
The 'VCSCommandBufferInfo' variable is a list which contains, in order, the
|
||||||
|
revision of the current file, the latest revision of the file in the
|
||||||
|
repository, and (for CVS) the name of the branch. If those values cannot be
|
||||||
|
determined, the list is a single element: 'Unknown'.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
6. SSH "integration" *vcscommand-ssh*
|
||||||
|
|
||||||
|
The following instructions are intended for use in integrating the
|
||||||
|
vcscommand.vim plugin with an SSH-based CVS environment.
|
||||||
|
|
||||||
|
Familiarity with SSH and CVS are assumed.
|
||||||
|
|
||||||
|
These instructions assume that the intent is to have a message box pop up in
|
||||||
|
order to allow the user to enter a passphrase. If, instead, the user is
|
||||||
|
comfortable using certificate-based authentication, then only instructions
|
||||||
|
6.1.1 and 6.1.2 (and optionally 6.1.4) need to be followed; ssh should then
|
||||||
|
work transparently.
|
||||||
|
|
||||||
|
6.1 Environment settings *vcscommand-ssh-env*
|
||||||
|
|
||||||
|
6.1.1 CVSROOT should be set to something like:
|
||||||
|
|
||||||
|
:ext:user@host:/path_to_repository
|
||||||
|
|
||||||
|
6.1.2 CVS_RSH should be set to:
|
||||||
|
|
||||||
|
ssh
|
||||||
|
|
||||||
|
Together, those settings tell CVS to use ssh as the transport when
|
||||||
|
performing CVS calls.
|
||||||
|
|
||||||
|
6.1.3 SSH_ASKPASS should be set to the password-dialog program. In my case,
|
||||||
|
running gnome, it's set to:
|
||||||
|
|
||||||
|
/usr/libexec/openssh/gnome-ssh-askpass
|
||||||
|
|
||||||
|
This tells SSH how to get passwords if no input is available.
|
||||||
|
|
||||||
|
6.1.4 OPTIONAL. You may need to set SSH_SERVER to the location of the cvs
|
||||||
|
executable on the remote (server) machine.
|
||||||
|
|
||||||
|
6.2 CVS wrapper program *vcscommand-ssh-wrapper*
|
||||||
|
|
||||||
|
Now you need to convince SSH to use the password-dialog program. This means
|
||||||
|
you need to execute SSH (and therefore CVS) without standard input. The
|
||||||
|
following script is a simple perl wrapper that dissasociates the CVS command
|
||||||
|
from the current terminal. Specific steps to do this may vary from system to
|
||||||
|
system; the following example works for me on linux.
|
||||||
|
|
||||||
|
#!/usr/bin/perl -w
|
||||||
|
use strict;
|
||||||
|
use POSIX qw(setsid);
|
||||||
|
open STDIN, '/dev/null';
|
||||||
|
fork and do {wait; exit;};
|
||||||
|
setsid;
|
||||||
|
exec('cvs', @ARGV);
|
||||||
|
|
||||||
|
6.3 Configuring vcscommand.vim *vcscommand-ssh-config*
|
||||||
|
|
||||||
|
At this point, you should be able to use your wrapper script to invoke CVS with
|
||||||
|
various commands, and get the password dialog. All that's left is to make CVS
|
||||||
|
use your newly-created wrapper script.
|
||||||
|
|
||||||
|
6.3.1 Tell vcscommand.vim what CVS executable to use. The easiest way to do this
|
||||||
|
is globally, by putting the following in your .vimrc:
|
||||||
|
|
||||||
|
let VCSCommandCVSExec=/path/to/cvs/wrapper/script
|
||||||
|
|
||||||
|
6.4 Where to go from here *vcscommand-ssh-other*
|
||||||
|
|
||||||
|
The script given above works even when non-SSH CVS connections are used,
|
||||||
|
except possibly when interactively entering the message for CVS commit log
|
||||||
|
(depending on the editor you use... VIM works fine). Since the vcscommand.vim
|
||||||
|
plugin handles that message without a terminal, the wrapper script can be used
|
||||||
|
all the time.
|
||||||
|
|
||||||
|
This allows mixed-mode operation, where some work is done with SSH-based CVS
|
||||||
|
repositories, and others with pserver or local access.
|
||||||
|
|
||||||
|
It is possible, though beyond the scope of the plugin, to dynamically set the
|
||||||
|
CVS executable based on the CVSROOT for the file being edited. The user
|
||||||
|
events provided (such as VCSBufferCreated and VCSBufferSetup) can be used to
|
||||||
|
set a buffer-local value (b:VCSCommandCVSExec) to override the CVS executable
|
||||||
|
on a file-by-file basis. Alternatively, much the same can be done (less
|
||||||
|
automatically) by the various project-oriented plugins out there.
|
||||||
|
|
||||||
|
It is highly recommended for ease-of-use that certificates with no passphrase
|
||||||
|
or ssh-agent are employed so that the user is not given the password prompt
|
||||||
|
too often.
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
7. Changes from cvscommand *cvscommand-changes*
|
||||||
|
|
||||||
|
1. Require Vim 7 in order to leverage several convenient features; also
|
||||||
|
because I wanted to play with Vim 7.
|
||||||
|
|
||||||
|
2. Renamed commands to start with 'VCS' instead of 'CVS'. The exceptions are
|
||||||
|
the 'CVSEdit' and 'CVSWatch' family of commands, which are specific to CVS.
|
||||||
|
|
||||||
|
3. Renamed options, events to start with 'VCSCommand'.
|
||||||
|
|
||||||
|
4. Removed option to jump to the parent version of the current line in an
|
||||||
|
annotated buffer, as opposed to the version on the current line. This made
|
||||||
|
little sense in the branching scheme used by subversion, where jumping to a
|
||||||
|
parent branch required finding a different location in the repository. It
|
||||||
|
didn't work consistently in CVS anyway.
|
||||||
|
|
||||||
|
5. Removed option to have nameless scratch buffers.
|
||||||
|
|
||||||
|
6. Changed default behavior of scratch buffers to split the window instead of
|
||||||
|
displaying in the current window. This may still be overridden using the
|
||||||
|
'VCSCommandEdit' option.
|
||||||
|
|
||||||
|
7. Split plugin into multiple plugins.
|
||||||
|
|
||||||
|
8. Added 'VCSLock' and 'VCSUnlock' commands. These are implemented for
|
||||||
|
subversion but not for CVS. These were not kept specific to subversion as they
|
||||||
|
seemed more general in nature and more likely to be supported by any future VCS
|
||||||
|
supported by this plugin.
|
||||||
|
|
||||||
|
9. Changed name of buffer variables set by commands.
|
||||||
|
|
||||||
|
'b:cvsOrigBuffNR' became 'b:VCSCommandOriginalBuffer'
|
||||||
|
'b:cvscmd' became 'b:VCSCommandCommand'
|
||||||
|
|
||||||
|
10. Added new automatic variables to command result buffers.
|
||||||
|
|
||||||
|
'b:VCSCommandSourceFile'
|
||||||
|
'b:VCSCommandVCSType'
|
||||||
|
|
||||||
|
==============================================================================
|
||||||
|
|
||||||
|
8. Known bugs *vcscommand-bugs*
|
||||||
|
|
||||||
|
Please let me know if you run across any.
|
||||||
|
|
||||||
|
CVSUnedit may, if a file is changed from the repository, provide prompt text
|
||||||
|
to determine whether the changes should be thrown away. Currently, that text
|
||||||
|
shows up in the CVS result buffer as information; there is no way for the user
|
||||||
|
to actually respond to the prompt and the CVS unedit command does nothing. If
|
||||||
|
this really bothers anyone, please let me know.
|
||||||
|
|
||||||
|
VCSVimDiff, when using the original (real) source buffer as one of the diff
|
||||||
|
buffers, uses some hacks to try to restore the state of the original buffer
|
||||||
|
when the scratch buffer containing the other version is destroyed. There may
|
||||||
|
still be bugs in here, depending on many configuration details.
|
||||||
|
|
||||||
|
vim:tw=78:ts=8:ft=help
|
262
vimfiles/plugin/vcsbzr.vim
Normal file
262
vimfiles/plugin/vcsbzr.vim
Normal file
@ -0,0 +1,262 @@
|
|||||||
|
" 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
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
|
1442
vimfiles/plugin/vcscommand.vim
Normal file
1442
vimfiles/plugin/vcscommand.vim
Normal file
File diff suppressed because it is too large
Load Diff
451
vimfiles/plugin/vcscvs.vim
Normal file
451
vimfiles/plugin/vcscvs.vim
Normal file
@ -0,0 +1,451 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" CVS 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
|
||||||
|
"
|
||||||
|
" Command documentation {{{2
|
||||||
|
"
|
||||||
|
" The following commands only apply to files under CVS source control.
|
||||||
|
"
|
||||||
|
" CVSEdit Performs "cvs edit" on the current file.
|
||||||
|
"
|
||||||
|
" CVSEditors Performs "cvs editors" on the current file.
|
||||||
|
"
|
||||||
|
" CVSUnedit Performs "cvs unedit" on the current file.
|
||||||
|
"
|
||||||
|
" CVSWatch Takes an argument which must be one of [on|off|add|remove].
|
||||||
|
" Performs "cvs watch" with the given argument on the current
|
||||||
|
" file.
|
||||||
|
"
|
||||||
|
" CVSWatchers Performs "cvs watchers" on the current file.
|
||||||
|
"
|
||||||
|
" CVSWatchAdd Alias for "CVSWatch add"
|
||||||
|
"
|
||||||
|
" CVSWatchOn Alias for "CVSWatch on"
|
||||||
|
"
|
||||||
|
" CVSWatchOff Alias for "CVSWatch off"
|
||||||
|
"
|
||||||
|
" CVSWatchRemove Alias for "CVSWatch remove"
|
||||||
|
"
|
||||||
|
" Mapping documentation: {{{2
|
||||||
|
"
|
||||||
|
" By default, a mapping is defined for each command. User-provided mappings
|
||||||
|
" can be used instead by mapping to <Plug>CommandName, for instance:
|
||||||
|
"
|
||||||
|
" nnoremap ,ce <Plug>CVSEdit
|
||||||
|
"
|
||||||
|
" The default mappings are as follow:
|
||||||
|
"
|
||||||
|
" <Leader>ce CVSEdit
|
||||||
|
" <Leader>cE CVSEditors
|
||||||
|
" <Leader>ct CVSUnedit
|
||||||
|
" <Leader>cwv CVSWatchers
|
||||||
|
" <Leader>cwa CVSWatchAdd
|
||||||
|
" <Leader>cwn CVSWatchOn
|
||||||
|
" <Leader>cwf CVSWatchOff
|
||||||
|
" <Leader>cwr CVSWatchRemove
|
||||||
|
"
|
||||||
|
" Options documentation: {{{2
|
||||||
|
"
|
||||||
|
" VCSCommandCVSExec
|
||||||
|
" This variable specifies the CVS executable. If not set, it defaults to
|
||||||
|
" 'cvs' executed from the user's executable path.
|
||||||
|
"
|
||||||
|
" VCSCommandCVSDiffOpt
|
||||||
|
" This variable, if set, determines the options passed to the cvs diff
|
||||||
|
" command. If not set, it defaults to 'u'.
|
||||||
|
|
||||||
|
" 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
|
||||||
|
" CVS is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:cvsFunctions = {}
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the CVS executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'CVS'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
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
|
||||||
|
throw 'CVS VCSCommand plugin called on non-CVS item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:GetRevision() {{{2
|
||||||
|
" Function for retrieving the current buffer's revision number.
|
||||||
|
" Returns: Revision number or an empty string if an error occurs.
|
||||||
|
|
||||||
|
function! s:GetRevision()
|
||||||
|
if !exists('b:VCSCommandBufferInfo')
|
||||||
|
let b:VCSCommandBufferInfo = s:cvsFunctions.GetBufferInfo()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if len(b:VCSCommandBufferInfo) > 0
|
||||||
|
return b:VCSCommandBufferInfo[0]
|
||||||
|
else
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Identify(buffer) {{{2
|
||||||
|
function! s:cvsFunctions.Identify(buffer)
|
||||||
|
let fileName = resolve(bufname(a:buffer))
|
||||||
|
if isdirectory(fileName)
|
||||||
|
let directoryName = fileName
|
||||||
|
else
|
||||||
|
let directoryName = fnamemodify(fileName, ':h')
|
||||||
|
endif
|
||||||
|
if strlen(directoryName) > 0
|
||||||
|
let CVSRoot = directoryName . '/CVS/Root'
|
||||||
|
else
|
||||||
|
let CVSRoot = 'CVS/Root'
|
||||||
|
endif
|
||||||
|
if filereadable(CVSRoot)
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Add(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype == 'CVSannotate'
|
||||||
|
" This is a CVSAnnotate buffer. Perform annotation of the version
|
||||||
|
" indicated by the current line.
|
||||||
|
let caption = matchstr(getline('.'),'\v^[0-9.]+')
|
||||||
|
|
||||||
|
if VCSCommandGetOption('VCSCommandCVSAnnotateParent', 0) != 0
|
||||||
|
if caption != '1.1'
|
||||||
|
let revmaj = matchstr(caption,'\v[0-9.]+\ze\.[0-9]+')
|
||||||
|
let revmin = matchstr(caption,'\v[0-9.]+\.\zs[0-9]+') - 1
|
||||||
|
if revmin == 0
|
||||||
|
" Jump to ancestor branch
|
||||||
|
let caption = matchstr(revmaj,'\v[0-9.]+\ze\.[0-9]+')
|
||||||
|
else
|
||||||
|
let caption = revmaj . "." . revmin
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
let options = ['-r' . caption]
|
||||||
|
else
|
||||||
|
" CVS defaults to pulling HEAD, regardless of current branch.
|
||||||
|
" Therefore, always pass desired revision.
|
||||||
|
let caption = ''
|
||||||
|
let options = ['-r' . s:GetRevision()]
|
||||||
|
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 = a:argList
|
||||||
|
endif
|
||||||
|
|
||||||
|
let resultBuffer = s:DoCommand(join(['-q', 'annotate'] + options), 'annotate', caption, {})
|
||||||
|
if resultBuffer > 0
|
||||||
|
" Remove header lines from standard error
|
||||||
|
silent v/^\d\+\%(\.\d\+\)\+/d
|
||||||
|
endif
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Commit(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Commit(argList)
|
||||||
|
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
if resultBuffer == 0
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endif
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Delete() {{{2
|
||||||
|
" By default, use the -f option to remove the file first. If options are
|
||||||
|
" passed in, use those instead.
|
||||||
|
function! s:cvsFunctions.Delete(argList)
|
||||||
|
let options = ['-f']
|
||||||
|
let caption = ''
|
||||||
|
if len(a:argList) > 0
|
||||||
|
let options = a:argList
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
endif
|
||||||
|
return s:DoCommand(join(['remove'] + options, ' '), 'delete', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Diff(argList) {{{2
|
||||||
|
function! s:cvsFunctions.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, ' -r')]
|
||||||
|
let caption = '(' . a:argList[0] . ' : ' . get(a:argList, 1, 'current') . ')'
|
||||||
|
else
|
||||||
|
" Pass-through
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
let revOptions = a:argList
|
||||||
|
endif
|
||||||
|
|
||||||
|
let cvsDiffOpt = VCSCommandGetOption('VCSCommandCVSDiffOpt', 'u')
|
||||||
|
if cvsDiffOpt == ''
|
||||||
|
let diffOptions = []
|
||||||
|
else
|
||||||
|
let diffOptions = ['-' . cvsDiffOpt]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.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. This CVS extension adds branch name to the return
|
||||||
|
" list as well.
|
||||||
|
" Returns: List of results: [revision, repository, branch]
|
||||||
|
|
||||||
|
function! s:cvsFunctions.GetBufferInfo()
|
||||||
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
|
let fileName = bufname(originalBuffer)
|
||||||
|
if isdirectory(fileName)
|
||||||
|
let tag = ''
|
||||||
|
if filereadable(fileName . '/CVS/Tag')
|
||||||
|
let tagFile = readfile(fileName . '/CVS/Tag')
|
||||||
|
if len(tagFile) == 1
|
||||||
|
let tag = substitute(tagFile[0], '^T', '', '')
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
return [tag]
|
||||||
|
endif
|
||||||
|
let realFileName = fnamemodify(resolve(fileName), ':t')
|
||||||
|
if !filereadable(fileName)
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
let oldCwd = VCSCommandChangeToCurrentFileDir(fileName)
|
||||||
|
try
|
||||||
|
let statusText=s:VCSCommandUtility.system(s:Executable() . ' status -- "' . realFileName . '"')
|
||||||
|
if(v:shell_error)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
let revision=substitute(statusText, '^\_.*Working revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\)\_.*$', '\1', '')
|
||||||
|
|
||||||
|
" We can still be in a CVS-controlled directory without this being a CVS
|
||||||
|
" file
|
||||||
|
if match(revision, '^New file!$') >= 0
|
||||||
|
let revision='New'
|
||||||
|
elseif match(revision, '^\d\+\.\d\+\%(\.\d\+\.\d\+\)*$') <0
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let branch=substitute(statusText, '^\_.*Sticky Tag:\s\+\(\d\+\%(\.\d\+\)\+\|\a[A-Za-z0-9-_]*\|(none)\).*$', '\1', '')
|
||||||
|
let repository=substitute(statusText, '^\_.*Repository revision:\s*\(\d\+\%(\.\d\+\)\+\|New file!\|No revision control file\)\_.*$', '\1', '')
|
||||||
|
let repository=substitute(repository, '^New file!\|No revision control file$', 'New', '')
|
||||||
|
return [revision, repository, branch]
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Log() {{{2
|
||||||
|
function! s:cvsFunctions.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
|
||||||
|
|
||||||
|
return s:DoCommand(join(['log'] + options), 'log', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Revert(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('update -C', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Review(argList) {{{2
|
||||||
|
function! s:cvsFunctions.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('-q update -p' . versionOption, 'review', versiontag, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Status(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Status(argList)
|
||||||
|
return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:cvsFunctions.Update(argList) {{{2
|
||||||
|
function! s:cvsFunctions.Update(argList)
|
||||||
|
return s:DoCommand('update', 'update', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: CVS-specific functions {{{1
|
||||||
|
|
||||||
|
" Function: s:CVSEdit() {{{2
|
||||||
|
function! s:CVSEdit()
|
||||||
|
return s:DoCommand('edit', 'cvsedit', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:CVSEditors() {{{2
|
||||||
|
function! s:CVSEditors()
|
||||||
|
return s:DoCommand('editors', 'cvseditors', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:CVSUnedit() {{{2
|
||||||
|
function! s:CVSUnedit()
|
||||||
|
return s:DoCommand('unedit', 'cvsunedit', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:CVSWatch(onoff) {{{2
|
||||||
|
function! s:CVSWatch(onoff)
|
||||||
|
if a:onoff !~ '^\c\%(on\|off\|add\|remove\)$'
|
||||||
|
echoerr 'Argument to CVSWatch must be one of [on|off|add|remove]'
|
||||||
|
return -1
|
||||||
|
end
|
||||||
|
return s:DoCommand('watch ' . tolower(a:onoff), 'cvswatch', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:CVSWatchers() {{{2
|
||||||
|
function! s:CVSWatchers()
|
||||||
|
return s:DoCommand('watchers', 'cvswatchers', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:cvsFunctions.AnnotateSplitRegex = '): '
|
||||||
|
|
||||||
|
" Section: Command definitions {{{1
|
||||||
|
" Section: Primary commands {{{2
|
||||||
|
com! CVSEdit call s:CVSEdit()
|
||||||
|
com! CVSEditors call s:CVSEditors()
|
||||||
|
com! CVSUnedit call s:CVSUnedit()
|
||||||
|
com! -nargs=1 CVSWatch call s:CVSWatch(<f-args>)
|
||||||
|
com! CVSWatchAdd call s:CVSWatch('add')
|
||||||
|
com! CVSWatchOn call s:CVSWatch('on')
|
||||||
|
com! CVSWatchOff call s:CVSWatch('off')
|
||||||
|
com! CVSWatchRemove call s:CVSWatch('remove')
|
||||||
|
com! CVSWatchers call s:CVSWatchers()
|
||||||
|
|
||||||
|
" Section: Plugin command mappings {{{1
|
||||||
|
|
||||||
|
let s:cvsExtensionMappings = {}
|
||||||
|
if !exists("no_plugin_maps")
|
||||||
|
let mappingInfo = [
|
||||||
|
\['CVSEdit', 'CVSEdit', 'e'],
|
||||||
|
\['CVSEditors', 'CVSEditors', 'E'],
|
||||||
|
\['CVSUnedit', 'CVSUnedit', 't'],
|
||||||
|
\['CVSWatchers', 'CVSWatchers', 'wv'],
|
||||||
|
\['CVSWatchAdd', 'CVSWatch add', 'wa'],
|
||||||
|
\['CVSWatchOff', 'CVSWatch off', 'wf'],
|
||||||
|
\['CVSWatchOn', 'CVSWatch on', 'wn'],
|
||||||
|
\['CVSWatchRemove', 'CVSWatch remove', 'wr']
|
||||||
|
\]
|
||||||
|
|
||||||
|
for [pluginName, commandText, shortCut] in mappingInfo
|
||||||
|
execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
|
||||||
|
if !hasmapto('<Plug>' . pluginName)
|
||||||
|
let s:cvsExtensionMappings[shortCut] = commandText
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
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
|
247
vimfiles/plugin/vcsgit.vim
Normal file
247
vimfiles/plugin/vcsgit.vim
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" git 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
|
||||||
|
"
|
||||||
|
" VCSCommandGitExec
|
||||||
|
" This variable specifies the git executable. If not set, it defaults to
|
||||||
|
" 'git' executed from the user's executable path.
|
||||||
|
"
|
||||||
|
" VCSCommandGitDiffOpt
|
||||||
|
" This variable, if set, determines the default options passed to the
|
||||||
|
" VCSDiff command. If any options (starting with '-') are passed to the
|
||||||
|
" command, this variable is not used.
|
||||||
|
|
||||||
|
" 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
|
||||||
|
" git is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:gitFunctions = {}
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the git executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'git'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
else
|
||||||
|
throw 'git VCSCommand plugin called on non-git item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Identify(buffer) {{{2
|
||||||
|
" This function only returns an inexact match due to the detection method used
|
||||||
|
" by git, which simply traverses the directory structure upward.
|
||||||
|
function! s:gitFunctions.Identify(buffer)
|
||||||
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(a:buffer)))
|
||||||
|
try
|
||||||
|
call s:VCSCommandUtility.system(s:Executable() . ' rev-parse --is-inside-work-tree')
|
||||||
|
if(v:shell_error)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return g:VCSCOMMAND_IDENTIFY_INEXACT
|
||||||
|
endif
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Add(argList) {{{2
|
||||||
|
function! s:gitFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:gitFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype == 'gitannotate'
|
||||||
|
" Perform annotation of the version indicated by the current line.
|
||||||
|
let options = matchstr(getline('.'),'^\x\+')
|
||||||
|
else
|
||||||
|
let options = ''
|
||||||
|
endif
|
||||||
|
elseif len(a:argList) == 1 && a:argList[0] !~ '^-'
|
||||||
|
let options = a:argList[0]
|
||||||
|
else
|
||||||
|
let options = join(a:argList, ' ')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand('blame ' . options, 'annotate', options, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Commit(argList) {{{2
|
||||||
|
function! s:gitFunctions.Commit(argList)
|
||||||
|
try
|
||||||
|
return s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
catch /\m^Version control command failed.*nothing\%( added\)\? to commit/
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Delete() {{{2
|
||||||
|
" All options are passed through.
|
||||||
|
function! s:gitFunctions.Delete(argList)
|
||||||
|
let options = a:argList
|
||||||
|
let caption = join(a:argList, ' ')
|
||||||
|
return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Diff(argList) {{{2
|
||||||
|
" Pass-through call to git-diff. If no options (starting with '-') are found,
|
||||||
|
" then the options in the 'VCSCommandGitDiffOpt' variable are added.
|
||||||
|
function! s:gitFunctions.Diff(argList)
|
||||||
|
let gitDiffOpt = VCSCommandGetOption('VCSCommandGitDiffOpt', '')
|
||||||
|
if gitDiffOpt == ''
|
||||||
|
let diffOptions = []
|
||||||
|
else
|
||||||
|
let diffOptions = [gitDiffOpt]
|
||||||
|
for arg in a:argList
|
||||||
|
if arg =~ '^-'
|
||||||
|
let diffOptions = []
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.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. This CVS extension adds branch name to the return
|
||||||
|
" list as well.
|
||||||
|
" Returns: List of results: [revision, repository, branch]
|
||||||
|
|
||||||
|
function! s:gitFunctions.GetBufferInfo()
|
||||||
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
|
||||||
|
try
|
||||||
|
let branch = substitute(s:VCSCommandUtility.system(s:Executable() . ' symbolic-ref -q HEAD'), '\n$', '', '')
|
||||||
|
if v:shell_error
|
||||||
|
let branch = 'DETACHED'
|
||||||
|
else
|
||||||
|
let branch = substitute(branch, '^refs/heads/', '', '')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let info = [branch]
|
||||||
|
|
||||||
|
for method in split(VCSCommandGetOption('VCSCommandGitDescribeArgList', (',tags,all,always')), ',', 1)
|
||||||
|
if method != ''
|
||||||
|
let method = ' --' . method
|
||||||
|
endif
|
||||||
|
let tag = substitute(s:VCSCommandUtility.system(s:Executable() . ' describe' . method), '\n$', '', '')
|
||||||
|
if !v:shell_error
|
||||||
|
call add(info, tag)
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return info
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Log() {{{2
|
||||||
|
function! s:gitFunctions.Log(argList)
|
||||||
|
return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Revert(argList) {{{2
|
||||||
|
function! s:gitFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('checkout', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Review(argList) {{{2
|
||||||
|
function! s:gitFunctions.Review(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
let revision = 'HEAD'
|
||||||
|
else
|
||||||
|
let revision = a:argList[0]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname(VCSCommandGetOriginalBuffer('%'))))
|
||||||
|
try
|
||||||
|
let prefix = s:VCSCommandUtility.system(s:Executable() . ' rev-parse --show-prefix')
|
||||||
|
finally
|
||||||
|
call VCSCommandChdir(oldCwd)
|
||||||
|
endtry
|
||||||
|
|
||||||
|
let prefix = substitute(prefix, '\n$', '', '')
|
||||||
|
let blob = '"' . revision . ':' . prefix . '<VCSCOMMANDFILE>"'
|
||||||
|
return s:DoCommand('show ' . blob, 'review', revision, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Status(argList) {{{2
|
||||||
|
function! s:gitFunctions.Status(argList)
|
||||||
|
return s:DoCommand(join(['status'] + a:argList), 'status', join(a:argList), {'allowNonZeroExit': 1})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:gitFunctions.Update(argList) {{{2
|
||||||
|
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."
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:gitFunctions.AnnotateSplitRegex = ') '
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
let s:VCSCommandUtility = VCSCommandRegisterModule('git', expand('<sfile>'), s:gitFunctions, [])
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
273
vimfiles/plugin/vcshg.vim
Normal file
273
vimfiles/plugin/vcshg.vim
Normal file
@ -0,0 +1,273 @@
|
|||||||
|
" 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
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+\zs\d+')
|
||||||
|
let options = ' -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
|
257
vimfiles/plugin/vcssvk.vim
Normal file
257
vimfiles/plugin/vcssvk.vim
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" SVK 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
|
||||||
|
"
|
||||||
|
" VCSCommandSVKExec
|
||||||
|
" This variable specifies the SVK executable. If not set, it defaults to
|
||||||
|
" 'svk' 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
|
||||||
|
" SVK is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:svkFunctions = {}
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the SVK executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'SVK'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
else
|
||||||
|
throw 'SVK VCSCommand plugin called on non-SVK item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Identify(buffer) {{{2
|
||||||
|
function! s:svkFunctions.Identify(buffer)
|
||||||
|
let fileName = resolve(bufname(a:buffer))
|
||||||
|
if isdirectory(fileName)
|
||||||
|
let directoryName = fileName
|
||||||
|
else
|
||||||
|
let directoryName = fnamemodify(fileName, ':p:h')
|
||||||
|
endif
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' info -- "' . directoryName . '"', "no")
|
||||||
|
if(v:shell_error)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Add() {{{2
|
||||||
|
function! s:svkFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:svkFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype == 'SVKannotate'
|
||||||
|
" 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:svkFunctions.Commit(argList) {{{2
|
||||||
|
function! s:svkFunctions.Commit(argList)
|
||||||
|
let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
if resultBuffer == 0
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Delete() {{{2
|
||||||
|
function! s:svkFunctions.Delete(argList)
|
||||||
|
return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Diff(argList) {{{2
|
||||||
|
function! s:svkFunctions.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, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.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:svkFunctions.GetBufferInfo()
|
||||||
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
|
let fileName = resolve(bufname(originalBuffer))
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status -v -- "' . fileName . '"')
|
||||||
|
if(v:shell_error)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" File not under SVK control.
|
||||||
|
if statusText =~ '^?'
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let [flags, revision, repository] = matchlist(statusText, '^\(.\{3}\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s')[1:3]
|
||||||
|
if revision == ''
|
||||||
|
" Error
|
||||||
|
return ['Unknown']
|
||||||
|
elseif flags =~ '^A'
|
||||||
|
return ['New', 'New']
|
||||||
|
else
|
||||||
|
return [revision, repository]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Info(argList) {{{2
|
||||||
|
function! s:svkFunctions.Info(argList)
|
||||||
|
return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Lock(argList) {{{2
|
||||||
|
function! s:svkFunctions.Lock(argList)
|
||||||
|
return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Log() {{{2
|
||||||
|
function! s:svkFunctions.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:svkFunctions.Revert(argList) {{{2
|
||||||
|
function! s:svkFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('revert', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Review(argList) {{{2
|
||||||
|
function! s:svkFunctions.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:svkFunctions.Status(argList) {{{2
|
||||||
|
function! s:svkFunctions.Status(argList)
|
||||||
|
let options = ['-v']
|
||||||
|
if len(a:argList) != 0
|
||||||
|
let options = a:argList
|
||||||
|
endif
|
||||||
|
return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svkFunctions.Unlock(argList) {{{2
|
||||||
|
function! s:svkFunctions.Unlock(argList)
|
||||||
|
return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
" Function: s:svkFunctions.Update(argList) {{{2
|
||||||
|
function! s:svkFunctions.Update(argList)
|
||||||
|
return s:DoCommand('update', 'update', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
let s:VCSCommandUtility = VCSCommandRegisterModule('SVK', expand('<sfile>'), s:svkFunctions, [])
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
284
vimfiles/plugin/vcssvn.vim
Normal file
284
vimfiles/plugin/vcssvn.vim
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
" vim600: set foldmethod=marker:
|
||||||
|
"
|
||||||
|
" SVN 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
|
||||||
|
"
|
||||||
|
" VCSCommandSVNExec
|
||||||
|
" This variable specifies the SVN executable. If not set, it defaults to
|
||||||
|
" 'svn' executed from the user's executable path.
|
||||||
|
"
|
||||||
|
" VCSCommandSVNDiffExt
|
||||||
|
" This variable, if set, sets the external diff program used by Subversion.
|
||||||
|
"
|
||||||
|
" VCSCommandSVNDiffOpt
|
||||||
|
" This variable, if set, determines the options passed to the svn 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
|
||||||
|
|
||||||
|
runtime plugin/vcscommand.vim
|
||||||
|
|
||||||
|
if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
|
||||||
|
" SVN is not installed
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let s:save_cpo=&cpo
|
||||||
|
set cpo&vim
|
||||||
|
|
||||||
|
" Section: Variable initialization {{{1
|
||||||
|
|
||||||
|
let s:svnFunctions = {}
|
||||||
|
|
||||||
|
" 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
|
||||||
|
" Wrapper to VCSCommandDoCommand to add the name of the SVN executable to the
|
||||||
|
" command argument.
|
||||||
|
function! s:DoCommand(cmd, cmdName, statusText, options)
|
||||||
|
if VCSCommandGetVCSType(expand('%')) == 'SVN'
|
||||||
|
let fullCmd = s:Executable() . ' ' . a:cmd
|
||||||
|
return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
|
||||||
|
else
|
||||||
|
throw 'SVN VCSCommand plugin called on non-SVN item.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Section: VCS function implementations {{{1
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Identify(buffer) {{{2
|
||||||
|
function! s:svnFunctions.Identify(buffer)
|
||||||
|
let fileName = resolve(bufname(a:buffer))
|
||||||
|
if isdirectory(fileName)
|
||||||
|
let directoryName = fileName
|
||||||
|
else
|
||||||
|
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
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Add() {{{2
|
||||||
|
function! s:svnFunctions.Add(argList)
|
||||||
|
return s:DoCommand(join(['add'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Annotate(argList) {{{2
|
||||||
|
function! s:svnFunctions.Annotate(argList)
|
||||||
|
if len(a:argList) == 0
|
||||||
|
if &filetype == 'SVNannotate'
|
||||||
|
" 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
|
||||||
|
|
||||||
|
return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Commit(argList) {{{2
|
||||||
|
function! s:svnFunctions.Commit(argList)
|
||||||
|
let resultBuffer = s:DoCommand('commit --non-interactive -F "' . a:argList[0] . '"', 'commit', '', {})
|
||||||
|
if resultBuffer == 0
|
||||||
|
echomsg 'No commit needed.'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Delete() {{{2
|
||||||
|
function! s:svnFunctions.Delete(argList)
|
||||||
|
return s:DoCommand(join(['delete --non-interactive'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Diff(argList) {{{2
|
||||||
|
function! s:svnFunctions.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 svnDiffExt = VCSCommandGetOption('VCSCommandSVNDiffExt', '')
|
||||||
|
if svnDiffExt == ''
|
||||||
|
let diffExt = []
|
||||||
|
else
|
||||||
|
let diffExt = ['--diff-cmd ' . svnDiffExt]
|
||||||
|
endif
|
||||||
|
|
||||||
|
let svnDiffOpt = VCSCommandGetOption('VCSCommandSVNDiffOpt', '')
|
||||||
|
if svnDiffOpt == ''
|
||||||
|
let diffOptions = []
|
||||||
|
else
|
||||||
|
let diffOptions = ['-x -' . svnDiffOpt]
|
||||||
|
endif
|
||||||
|
|
||||||
|
return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.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:svnFunctions.GetBufferInfo()
|
||||||
|
let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
|
||||||
|
let fileName = bufname(originalBuffer)
|
||||||
|
let statusText = s:VCSCommandUtility.system(s:Executable() . ' status --non-interactive -vu -- "' . fileName . '"')
|
||||||
|
if(v:shell_error)
|
||||||
|
return []
|
||||||
|
endif
|
||||||
|
|
||||||
|
" File not under SVN control.
|
||||||
|
if statusText =~ '^?'
|
||||||
|
return ['Unknown']
|
||||||
|
endif
|
||||||
|
|
||||||
|
let [flags, revision, repository] = matchlist(statusText, '^\(.\{9}\)\s*\(\d\+\)\s\+\(\d\+\)')[1:3]
|
||||||
|
if revision == ''
|
||||||
|
" Error
|
||||||
|
return ['Unknown']
|
||||||
|
elseif flags =~ '^A'
|
||||||
|
return ['New', 'New']
|
||||||
|
elseif flags =~ '*'
|
||||||
|
return [revision, repository, '*']
|
||||||
|
else
|
||||||
|
return [revision, repository]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Info(argList) {{{2
|
||||||
|
function! s:svnFunctions.Info(argList)
|
||||||
|
return s:DoCommand(join(['info --non-interactive'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Lock(argList) {{{2
|
||||||
|
function! s:svnFunctions.Lock(argList)
|
||||||
|
return s:DoCommand(join(['lock --non-interactive'] + a:argList, ' '), 'lock', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Log(argList) {{{2
|
||||||
|
function! s:svnFunctions.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 --non-interactive', '-v'] + options), 'log', caption, {})
|
||||||
|
return resultBuffer
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Revert(argList) {{{2
|
||||||
|
function! s:svnFunctions.Revert(argList)
|
||||||
|
return s:DoCommand('revert', 'revert', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Review(argList) {{{2
|
||||||
|
function! s:svnFunctions.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 --non-interactive' . versionOption, 'review', versiontag, {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Status(argList) {{{2
|
||||||
|
function! s:svnFunctions.Status(argList)
|
||||||
|
let options = ['-u', '-v']
|
||||||
|
if len(a:argList) != 0
|
||||||
|
let options = a:argList
|
||||||
|
endif
|
||||||
|
return s:DoCommand(join(['status --non-interactive'] + options, ' '), 'status', join(options, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Unlock(argList) {{{2
|
||||||
|
function! s:svnFunctions.Unlock(argList)
|
||||||
|
return s:DoCommand(join(['unlock --non-interactive'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Function: s:svnFunctions.Update(argList) {{{2
|
||||||
|
function! s:svnFunctions.Update(argList)
|
||||||
|
return s:DoCommand('update --non-interactive', 'update', '', {})
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" Annotate setting {{{2
|
||||||
|
let s:svnFunctions.AnnotateSplitRegex = '\s\+\S\+\s\+\S\+ '
|
||||||
|
|
||||||
|
" Section: Plugin Registration {{{1
|
||||||
|
let s:VCSCommandUtility = VCSCommandRegisterModule('SVN', expand('<sfile>'), s:svnFunctions, [])
|
||||||
|
|
||||||
|
let &cpo = s:save_cpo
|
45
vimfiles/syntax/cvsannotate.vim
Normal file
45
vimfiles/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
vimfiles/syntax/gitannotate.vim
Normal file
44
vimfiles/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
vimfiles/syntax/hgannotate.vim
Normal file
40
vimfiles/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
vimfiles/syntax/svkannotate.vim
Normal file
42
vimfiles/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
vimfiles/syntax/svnannotate.vim
Normal file
40
vimfiles/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"
|
31
vimfiles/syntax/vcscommit.vim
Normal file
31
vimfiles/syntax/vcscommit.vim
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
" Vim syntax file
|
||||||
|
" Language: VCS commit file
|
||||||
|
" 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.
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax region vcsComment start="^VCS: " end="$"
|
||||||
|
highlight link vcsComment Comment
|
||||||
|
let b:current_syntax = "vcscommit"
|
Loading…
x
Reference in New Issue
Block a user