r1244 - in /trunk/packages/vim-scripts: ./ debian/ doc/ html/ plugin/ syntax/

jamessan at users.alioth.debian.org jamessan at users.alioth.debian.org
Tue Apr 8 21:07:01 UTC 2008


Author: jamessan
Date: Tue Apr  8 21:07:01 2008
New Revision: 1244

URL: http://svn.debian.org/wsvn/pkg-vim/?sc=1&rev=1244
Log:
Update vcscommand

Removed:
    trunk/packages/vim-scripts/CHANGES.CVSCommand.txt
Modified:
    trunk/packages/vim-scripts/debian/changelog
    trunk/packages/vim-scripts/debian/vim-scripts.status
    trunk/packages/vim-scripts/doc/vcscommand.txt
    trunk/packages/vim-scripts/html/index.html
    trunk/packages/vim-scripts/html/plugin_vcscommand.vim.html
    trunk/packages/vim-scripts/plugin/vcscommand.vim
    trunk/packages/vim-scripts/plugin/vcscvs.vim
    trunk/packages/vim-scripts/plugin/vcsgit.vim
    trunk/packages/vim-scripts/plugin/vcssvk.vim
    trunk/packages/vim-scripts/plugin/vcssvn.vim
    trunk/packages/vim-scripts/syntax/CVSAnnotate.vim
    trunk/packages/vim-scripts/syntax/SVKAnnotate.vim
    trunk/packages/vim-scripts/syntax/SVNAnnotate.vim
    trunk/packages/vim-scripts/syntax/vcscommit.vim

Modified: trunk/packages/vim-scripts/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/debian/changelog?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/debian/changelog (original)
+++ trunk/packages/vim-scripts/debian/changelog Tue Apr  8 21:07:01 2008
@@ -8,9 +8,9 @@
       (Closes: #465330)
   * Updated addons:
     - xmledit, surround, debPlugin, Markdown syntax, NERD Commenter, Enhanced
-      Commentify.
+      Commentify, vcscommand.
   * New addons:
-    - DetectIndent: Automatically detect indent settings (Closes: #471890)
+    - DetectIndent: Automatically detect indent settings. (Closes: #471890)
 
  -- James Vega <jamessan at debian.org>  Tue, 05 Feb 2008 17:06:54 -0500
 

Modified: trunk/packages/vim-scripts/debian/vim-scripts.status
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/debian/vim-scripts.status?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/debian/vim-scripts.status (original)
+++ trunk/packages/vim-scripts/debian/vim-scripts.status Tue Apr  8 21:07:01 2008
@@ -139,7 +139,7 @@
 license:     public domain
 extras:	     doc/vcscommand.txt, plugin/vcscvs.vim, plugin/vcsgit.vim, plugin/vcssvn.vim, plugin/vcssvk.vim, syntax/CVSAnnotate.vim, syntax/SVNAnnotate.vim, syntax/SVKAnnotate.vim, syntax/vcscommit.vim
 disabledby:  let loaded_VCSCommand = 1
-version:     beta20
+version:     beta22
 
 script_name: plugin/utl.vim
 addon:       utl
@@ -172,7 +172,7 @@
 author_url:  http://www.vim.org/account/profile.php?user_id=62
 email:       Brandels_Mikesh at web.de
 license:     license [5], see below
-extras:      doc/EnhancedCommentify.txt, ftplugin/php_enhcomm.vim, ftplugin/ocaml_enhcomm.vim, LICENSE.EnhancedCommentify
+extras:      doc/EnhancedCommentify.txt, ftplugin/php_enhcomm.vim, ftplugin/ocaml_enhcomm.vim
 disabledby:  let DidEnhancedCommentify = 1
 version:     2.3
 

Modified: trunk/packages/vim-scripts/doc/vcscommand.txt
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/doc/vcscommand.txt?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/doc/vcscommand.txt (original)
+++ trunk/packages/vim-scripts/doc/vcscommand.txt Tue Apr  8 21:07:01 2008
@@ -34,6 +34,7 @@
 	vcscommand Manual	: |vcscommand-manual|
 	Customization		: |vcscommand-customize|
 	SSH "integration"	: |vcscommand-ssh|
+	Changes from cvscommand	: |cvscommand-changes|
 	Bugs			: |vcscommand-bugs|
 
 ==============================================================================
@@ -711,7 +712,48 @@
 
 ==============================================================================
 
-7. Known bugs						*vcscommand-bugs*
+7. Changes from cvscommandi				*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.
 

Modified: trunk/packages/vim-scripts/html/index.html
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/html/index.html?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/html/index.html (original)
+++ trunk/packages/vim-scripts/html/index.html Tue Apr  8 21:07:01 2008
@@ -49,7 +49,7 @@
    <li><a href="syntax_mkd.vim.html">syntax/mkd.vim.html</a></li>
   </ul>
   <p>
-  Page generated on Tue, 08 Apr 2008 16:41:46 -0400
+  Page generated on Tue, 08 Apr 2008 16:51:55 -0400
 .
   </p>
  </body>

Modified: trunk/packages/vim-scripts/html/plugin_vcscommand.vim.html
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/html/plugin_vcscommand.vim.html?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/html/plugin_vcscommand.vim.html (original)
+++ trunk/packages/vim-scripts/html/plugin_vcscommand.vim.html Tue Apr  8 21:07:01 2008
@@ -153,8 +153,8 @@
 <tr>
   <td class="lightbg"><b>&nbsp;script karma&nbsp;</b></td>
   <td>
-    Rating <b>1301/428</b>,
-    Downloaded by 19452  </td>
+    Rating <b>1347/446</b>,
+    Downloaded by 20420  </td>
 </tr>
 </table>
 <p>
@@ -204,6 +204,22 @@
     <th valign="top">release notes</th>
 </tr>
 <tr>
+        <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=8459">vcscommand.zip</a></td>
+    <td class="rowodd" valign="top" nowrap><b>beta22</b></td>
+    <td class="rowodd" valign="top" nowrap><i>2008-03-17</i></td>
+    <td class="rowodd" valign="top" nowrap>7.0</td>
+    <td class="rowodd" valign="top"><i><a href="/account/profile.php?user_id=241">Bob Hiestand</a></i></td>
+    <td class="rowodd" valign="top" width="2000">Added VCSCommandGitDescribeArgList option to control allowed modes of 'git describe' used in GetBufferInfo for git.&nbsp;&nbsp;This is a comma-separated list of arguments to try against git-describe.&nbsp;&nbsp;This is an attempt to have prioritized fallbacks of descriptions, and runs in order until it finds a valid description.&nbsp;&nbsp;This value defaults to ',tags,all,always', and so first searches annotated tags, then tags, then all references, then a commit description.</td>
+</tr>
+<tr>
+        <td class="roweven" valign="top" nowrap><a href="download_script.php?src_id=8435">vcscommand.zip</a></td>
+    <td class="roweven" valign="top" nowrap><b>beta21</b></td>
+    <td class="roweven" valign="top" nowrap><i>2008-03-11</i></td>
+    <td class="roweven" valign="top" nowrap>7.0</td>
+    <td class="roweven" valign="top"><i><a href="/account/profile.php?user_id=241">Bob Hiestand</a></i></td>
+    <td class="roweven" valign="top" width="2000">Tweaked buffer info for git buffers.
<br>
<br>Don't clobber &cp when testing for a vcs command.
<br>
<br>Added 'options' Dict to VCSCommandDoCommand for tweaking framework behavior.
<br>
<br>Allow non-zero vcs command exit status when 'allowNonZeroExit' option is passed to VCSCommandDoCommand.
<br>
<br>Implemented VCSStatus for git as (repository-wide) 'git status'.
<br>
<br>Converted to leading tab style.
<br>
<br>Distinguish between exact and inexact identifications by extensions.
<br>
<br>Mark git identification as inexact, so that using another VCS to control directories somewhere under a git-controlled directory does not identify the files incorrectly as git.
<br>
<br>Moved CHANGES.txt content into help file.
<br></td>
+</tr>
+<tr>
         <td class="rowodd" valign="top" nowrap><a href="download_script.php?src_id=8210">vcscommand.zip</a></td>
     <td class="rowodd" valign="top" nowrap><b>beta20</b></td>
     <td class="rowodd" valign="top" nowrap><i>2008-02-01</i></td>
@@ -503,8 +519,7 @@
           </td>
 
     <td align="right" valign="top">
-      	<a href="http://www.webconceptgroup.net"><img src="/images/logo_sponsor_wcg.jpg" width="131" height="30" border="0" alt="Sponsored by Web Concept Group Inc."></a>
-	<a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
+      		<a href="http://sourceforge.net" rel="nofollow"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=8&type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
     </td>
 
     <td><img src="/images/spacer.gif" width="5" height="1" alt=""></td>

Modified: trunk/packages/vim-scripts/plugin/vcscommand.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/vcscommand.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/plugin/vcscommand.vim (original)
+++ trunk/packages/vim-scripts/plugin/vcscommand.vim Tue Apr  8 21:07:01 2008
@@ -2,7 +2,7 @@
 "
 " Vim plugin to assist in working with files under control of CVS or SVN.
 "
-" Version:       Beta 20
+" Version:       Beta 22
 " Maintainer:    Bob Hiestand <bob.hiestand at gmail.com>
 " License:
 " Copyright (c) 2007 Bob Hiestand
@@ -273,13 +273,13 @@
 " system initialization.
 
 if exists('loaded_VCSCommand')
-   finish
+	finish
 endif
 let loaded_VCSCommand = 1
 
 if v:version < 700
-  echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
-  finish
+	echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
+	finish
 endif
 
 let s:save_cpo=&cpo
@@ -296,14 +296,29 @@
 " Section: Plugin initialization {{{1
 silent do VCSCommand User VCSPluginInit
 
+" Section: Constants declaration {{{1
+
+let g:VCSCOMMAND_IDENTIFY_EXACT = 1
+let g:VCSCOMMAND_IDENTIFY_INEXACT = -1
+
 " Section: Script variable initialization {{{1
 
+" plugin-specific information:  {vcs -> [script, {command -> function}, {key -> mapping}]}
 let s:plugins = {}
+
+" temporary values of overridden configuration variables
 let s:optionOverrides = {}
+
+" state flag used to vary behavior of certain automated actions
 let s:isEditFileRunning = 0
 
+" commands needed to restore diff buffers to their original state
 unlet! s:vimDiffRestoreCmd
+
+" original buffer currently reflected in vimdiff windows
 unlet! s:vimDiffSourceBuffer
+
+" 
 unlet! s:vimDiffScratchList
 
 " Section: Utility functions {{{1
@@ -313,7 +328,7 @@
 " invoked from a catch statement.
 
 function! s:ReportError(error)
-  echohl WarningMsg|echomsg 'VCSCommand:  ' . a:error|echohl None
+	echohl WarningMsg|echomsg 'VCSCommand:  ' . a:error|echohl None
 endfunction
 
 " Function: s:ExecuteExtensionMapping(mapping) {{{2
@@ -321,15 +336,15 @@
 " current buffer.
 
 function! s:ExecuteExtensionMapping(mapping)
-  let buffer = bufnr('%')
-  let vcsType = VCSCommandGetVCSType(buffer)
-  if !has_key(s:plugins, vcsType)
-    throw 'Unknown VCS type:  ' . vcsType
-  endif
-  if !has_key(s:plugins[vcsType][2], a:mapping)
-    throw 'This extended mapping is not defined for ' . vcsType
-  endif
-  silent execute 'normal' ':' .  s:plugins[vcsType][2][a:mapping] . "\<CR>"
+	let buffer = bufnr('%')
+	let vcsType = VCSCommandGetVCSType(buffer)
+	if !has_key(s:plugins, vcsType)
+		throw 'Unknown VCS type:  ' . vcsType
+	endif
+	if !has_key(s:plugins[vcsType][2], a:mapping)
+		throw 'This extended mapping is not defined for ' . vcsType
+	endif
+	silent execute 'normal' ':' .  s:plugins[vcsType][2][a:mapping] . "\<CR>"
 endfunction
 
 " Function: s:ExecuteVCSCommand(command, argList) {{{2
@@ -338,35 +353,35 @@
 " occurs.
 
 function! s:ExecuteVCSCommand(command, argList)
-  try
-    let buffer = bufnr('%')
-
-    let vcsType = VCSCommandGetVCSType(buffer)
-    if !has_key(s:plugins, vcsType)
-      throw 'Unknown VCS type:  ' . vcsType
-    endif
-
-    let originalBuffer = VCSCommandGetOriginalBuffer(buffer)
-    let bufferName = bufname(originalBuffer)
-
-    " It is already known that the directory is under VCS control.  No further
-    " checks are needed.  Otherwise, perform some basic sanity checks to avoid
-    " VCS-specific error messages from confusing things.
-    if !isdirectory(bufferName)
-      if !filereadable(bufferName)
-        throw 'No such file ' . bufferName
-      endif
-    endif
-
-    let functionMap = s:plugins[vcsType][1]
-    if !has_key(functionMap, a:command)
-      throw 'Command ''' . a:command . ''' not implemented for ' . vcsType
-    endif
-    return functionMap[a:command](a:argList)
-  catch
-    call s:ReportError(v:exception)
-    return -1
-  endtry
+	try
+		let buffer = bufnr('%')
+
+		let vcsType = VCSCommandGetVCSType(buffer)
+		if !has_key(s:plugins, vcsType)
+			throw 'Unknown VCS type:  ' . vcsType
+		endif
+
+		let originalBuffer = VCSCommandGetOriginalBuffer(buffer)
+		let bufferName = bufname(originalBuffer)
+
+		" It is already known that the directory is under VCS control.  No further
+		" checks are needed.  Otherwise, perform some basic sanity checks to avoid
+		" VCS-specific error messages from confusing things.
+		if !isdirectory(bufferName)
+			if !filereadable(bufferName)
+				throw 'No such file ' . bufferName
+			endif
+		endif
+
+		let functionMap = s:plugins[vcsType][1]
+		if !has_key(functionMap, a:command)
+			throw 'Command ''' . a:command . ''' not implemented for ' . vcsType
+		endif
+		return functionMap[a:command](a:argList)
+	catch
+		call s:ReportError(v:exception)
+		return -1
+	endtry
 endfunction
 
 " Function: s:GenerateResultBufferName(command, originalBuffer, vcsType, statusText) {{{2
@@ -374,19 +389,19 @@
 " overridden with the VCSResultBufferNameFunction variable.
 
 function! s:GenerateResultBufferName(command, originalBuffer, vcsType, statusText)
-  let fileName = bufname(a:originalBuffer)
-  let bufferName = a:vcsType . ' ' . a:command
-  if strlen(a:statusText) > 0
-    let bufferName .= ' ' . a:statusText
-  endif
-  let bufferName .= ' ' . fileName
-  let counter = 0
-  let versionedBufferName = bufferName
-  while buflisted(versionedBufferName)
-    let counter += 1
-    let versionedBufferName = bufferName . ' (' . counter . ')'
-  endwhile
-  return versionedBufferName
+	let fileName = bufname(a:originalBuffer)
+	let bufferName = a:vcsType . ' ' . a:command
+	if strlen(a:statusText) > 0
+		let bufferName .= ' ' . a:statusText
+	endif
+	let bufferName .= ' ' . fileName
+	let counter = 0
+	let versionedBufferName = bufferName
+	while buflisted(versionedBufferName)
+		let counter += 1
+		let versionedBufferName = bufferName . ' (' . counter . ')'
+	endwhile
+	return versionedBufferName
 endfunction
 
 " Function: s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsType, statusText) {{{2
@@ -394,19 +409,19 @@
 " file name with the VCS type and command appended as extensions.
 
 function! s:GenerateResultBufferNameWithExtension(command, originalBuffer, vcsType, statusText)
-  let fileName = bufname(a:originalBuffer)
-  let bufferName = a:vcsType . ' ' . a:command
-  if strlen(a:statusText) > 0
-    let bufferName .= ' ' . a:statusText
-  endif
-  let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs')
-  let counter = 0
-  let versionedBufferName = bufferName
-  while buflisted(versionedBufferName)
-    let counter += 1
-    let versionedBufferName = '(' . counter . ') ' . bufferName
-  endwhile
-  return versionedBufferName
+	let fileName = bufname(a:originalBuffer)
+	let bufferName = a:vcsType . ' ' . a:command
+	if strlen(a:statusText) > 0
+		let bufferName .= ' ' . a:statusText
+	endif
+	let bufferName .= ' ' . fileName . VCSCommandGetOption('VCSCommandResultBufferNameExtension', '.vcs')
+	let counter = 0
+	let versionedBufferName = bufferName
+	while buflisted(versionedBufferName)
+		let counter += 1
+		let versionedBufferName = '(' . counter . ') ' . bufferName
+	endwhile
+	return versionedBufferName
 endfunction
 
 " Function: s:EditFile(command, originalBuffer, statusText) {{{2
@@ -414,48 +429,48 @@
 " original buffer.
 
 function! s:EditFile(command, originalBuffer, statusText)
-  let vcsType = getbufvar(a:originalBuffer, 'VCSCommandVCSType')
-
-  let nameExtension = VCSCommandGetOption('VCSCommandResultBufferNameExtension', '')
-  if nameExtension == ''
-    let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferName')
-  else
-    let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferNameWithExtension')
-  endif
-
-  let resultBufferName = call(nameFunction, [a:command, a:originalBuffer, vcsType, a:statusText])
-
-  " Protect against useless buffer set-up
-  let s:isEditFileRunning += 1
-  try
-    let editCommand = VCSCommandGetOption('VCSCommandEdit', 'split')
-    if editCommand == 'split'
-      if VCSCommandGetOption('VCSCommandSplit', 'horizontal') == 'horizontal'
-        rightbelow split
-      else
-        vert rightbelow split
-      endif
-    endif
-    edit `=resultBufferName`
-    let b:VCSCommandCommand = a:command
-    let b:VCSCommandOriginalBuffer = a:originalBuffer
-    let b:VCSCommandSourceFile = bufname(a:originalBuffer)
-    let b:VCSCommandVCSType = vcsType
-
-    set buftype=nofile
-    set noswapfile
-    let &filetype = vcsType . a:command
-
-    if a:statusText != ''
-      let b:VCSCommandStatusText = a:statusText
-    endif
-
-    if VCSCommandGetOption('VCSCommandDeleteOnHide', 0)
-      set bufhidden=delete
-    endif
-  finally
-    let s:isEditFileRunning -= 1
-  endtry
+	let vcsType = getbufvar(a:originalBuffer, 'VCSCommandVCSType')
+
+	let nameExtension = VCSCommandGetOption('VCSCommandResultBufferNameExtension', '')
+	if nameExtension == ''
+		let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferName')
+	else
+		let nameFunction = VCSCommandGetOption('VCSCommandResultBufferNameFunction', 's:GenerateResultBufferNameWithExtension')
+	endif
+
+	let resultBufferName = call(nameFunction, [a:command, a:originalBuffer, vcsType, a:statusText])
+
+	" Protect against useless buffer set-up
+	let s:isEditFileRunning += 1
+	try
+		let editCommand = VCSCommandGetOption('VCSCommandEdit', 'split')
+		if editCommand == 'split'
+			if VCSCommandGetOption('VCSCommandSplit', 'horizontal') == 'horizontal'
+				rightbelow split
+			else
+				vert rightbelow split
+			endif
+		endif
+		edit `=resultBufferName`
+		let b:VCSCommandCommand = a:command
+		let b:VCSCommandOriginalBuffer = a:originalBuffer
+		let b:VCSCommandSourceFile = bufname(a:originalBuffer)
+		let b:VCSCommandVCSType = vcsType
+
+		set buftype=nofile
+		set noswapfile
+		let &filetype = vcsType . a:command
+
+		if a:statusText != ''
+			let b:VCSCommandStatusText = a:statusText
+		endif
+
+		if VCSCommandGetOption('VCSCommandDeleteOnHide', 0)
+			set bufhidden=delete
+		endif
+	finally
+		let s:isEditFileRunning -= 1
+	endtry
 
 endfunction
 
@@ -463,31 +478,31 @@
 " Attempts to set the b:VCSCommandBufferInfo variable
 
 function! s:SetupBuffer()
-  if (exists('b:VCSCommandBufferSetup') && b:VCSCommandBufferSetup)
-    " This buffer is already set up.
-    return
-  endif
-
-  if !isdirectory(@%) && (strlen(&buftype) > 0 || !filereadable(@%))
-    " No special status for special buffers other than directory buffers.
-    return
-  endif
-
-  if !VCSCommandGetOption('VCSCommandEnableBufferSetup', 0) || s:isEditFileRunning > 0
-    unlet! b:VCSCommandBufferSetup
-    return
-  endif
-
-  try
-    let vcsType = VCSCommandGetVCSType(bufnr('%'))
-    let b:VCSCommandBufferInfo = s:plugins[vcsType][1].GetBufferInfo()
-    silent do VCSCommand User VCSBufferSetup
-  catch /No suitable plugin/
-    " This is not a VCS-controlled file.
-    let b:VCSCommandBufferInfo = []
-  endtry
-
-  let b:VCSCommandBufferSetup = 1
+	if (exists('b:VCSCommandBufferSetup') && b:VCSCommandBufferSetup)
+		" This buffer is already set up.
+		return
+	endif
+
+	if !isdirectory(@%) && (strlen(&buftype) > 0 || !filereadable(@%))
+		" No special status for special buffers other than directory buffers.
+		return
+	endif
+
+	if !VCSCommandGetOption('VCSCommandEnableBufferSetup', 0) || s:isEditFileRunning > 0
+		unlet! b:VCSCommandBufferSetup
+		return
+	endif
+
+	try
+		let vcsType = VCSCommandGetVCSType(bufnr('%'))
+		let b:VCSCommandBufferInfo = s:plugins[vcsType][1].GetBufferInfo()
+		silent do VCSCommand User VCSBufferSetup
+	catch /No suitable plugin/
+		" This is not a VCS-controlled file.
+		let b:VCSCommandBufferInfo = []
+	endtry
+
+	let b:VCSCommandBufferSetup = 1
 endfunction
 
 " Function: s:MarkOrigBufferForSetup(buffer) {{{2
@@ -496,15 +511,15 @@
 " Returns:  The VCS buffer number in a passthrough mode.
 
 function! s:MarkOrigBufferForSetup(buffer)
-  checktime
-  if a:buffer > 0 
-    let origBuffer = VCSCommandGetOriginalBuffer(a:buffer)
-    " This should never not work, but I'm paranoid
-    if origBuffer != a:buffer
-      call setbufvar(origBuffer, 'VCSCommandBufferSetup', 0)
-    endif
-  endif
-  return a:buffer
+	checktime
+	if a:buffer > 0 
+		let origBuffer = VCSCommandGetOriginalBuffer(a:buffer)
+		" This should never not work, but I'm paranoid
+		if origBuffer != a:buffer
+			call setbufvar(origBuffer, 'VCSCommandBufferSetup', 0)
+		endif
+	endif
+	return a:buffer
 endfunction
 
 " Function: s:OverrideOption(option, [value]) {{{2
@@ -512,29 +527,29 @@
 " passed, the override is disabled.
 
 function! s:OverrideOption(option, ...)
-  if a:0 == 0
-    call remove(s:optionOverrides[a:option], -1)
-  else
-    if !has_key(s:optionOverrides, a:option)
-      let s:optionOverrides[a:option] = []
-    endif
-    call add(s:optionOverrides[a:option], a:1)
-  endif
+	if a:0 == 0
+		call remove(s:optionOverrides[a:option], -1)
+	else
+		if !has_key(s:optionOverrides, a:option)
+			let s:optionOverrides[a:option] = []
+		endif
+		call add(s:optionOverrides[a:option], a:1)
+	endif
 endfunction
 
 " Function: s:WipeoutCommandBuffers() {{{2
 " Clears all current VCS output buffers of the specified type for a given source.
 
 function! s:WipeoutCommandBuffers(originalBuffer, VCSCommand)
-  let buffer = 1
-  while buffer <= bufnr('$')
-    if getbufvar(buffer, 'VCSCommandOriginalBuffer') == a:originalBuffer
-      if getbufvar(buffer, 'VCSCommandCommand') == a:VCSCommand
-        execute 'bw' buffer
-      endif
-    endif
-    let buffer = buffer + 1
-  endwhile
+	let buffer = 1
+	while buffer <= bufnr('$')
+		if getbufvar(buffer, 'VCSCommandOriginalBuffer') == a:originalBuffer
+			if getbufvar(buffer, 'VCSCommandCommand') == a:VCSCommand
+				execute 'bw' buffer
+			endif
+		endif
+		let buffer = buffer + 1
+	endwhile
 endfunction
 
 " Function: s:VimDiffRestore(vimDiffBuff) {{{2
@@ -543,106 +558,106 @@
 " the appropriate setting command stored with that original buffer.
 
 function! s:VimDiffRestore(vimDiffBuff)
-  let s:isEditFileRunning += 1
-  try
-    if exists('s:vimDiffSourceBuffer')
-      if a:vimDiffBuff == s:vimDiffSourceBuffer
-        " Original file is being removed.
-        unlet! s:vimDiffSourceBuffer
-        unlet! s:vimDiffRestoreCmd
-        unlet! s:vimDiffScratchList
-      else
-        let index = index(s:vimDiffScratchList, a:vimDiffBuff)
-        if index >= 0
-          call remove(s:vimDiffScratchList, index)
-          if len(s:vimDiffScratchList) == 0
-            if exists('s:vimDiffRestoreCmd')
-              " All scratch buffers are gone, reset the original.
-              " Only restore if the source buffer is still in Diff mode
-
-              let sourceWinNR = bufwinnr(s:vimDiffSourceBuffer)
-              if sourceWinNR != -1
-                " The buffer is visible in at least one window
-                let currentWinNR = winnr()
-                while winbufnr(sourceWinNR) != -1
-                  if winbufnr(sourceWinNR) == s:vimDiffSourceBuffer
-                    execute sourceWinNR . 'wincmd w'
-                    if getwinvar(0, '&diff')
-                      execute s:vimDiffRestoreCmd
-                    endif
-                  endif
-                  let sourceWinNR = sourceWinNR + 1
-                endwhile
-                execute currentWinNR . 'wincmd w'
-              else
-                " The buffer is hidden.  It must be visible in order to set the
-                " diff option.
-                let currentBufNR = bufnr('')
-                execute 'hide buffer' s:vimDiffSourceBuffer
-                if getwinvar(0, '&diff')
-                  execute s:vimDiffRestoreCmd
-                endif
-                execute 'hide buffer' currentBufNR
-              endif
-
-              unlet s:vimDiffRestoreCmd
-            endif 
-            " All buffers are gone.
-            unlet s:vimDiffSourceBuffer
-            unlet s:vimDiffScratchList
-          endif
-        endif
-      endif
-    endif
-  finally
-    let s:isEditFileRunning -= 1
-  endtry
+	let s:isEditFileRunning += 1
+	try
+		if exists('s:vimDiffSourceBuffer')
+			if a:vimDiffBuff == s:vimDiffSourceBuffer
+				" Original file is being removed.
+				unlet! s:vimDiffSourceBuffer
+				unlet! s:vimDiffRestoreCmd
+				unlet! s:vimDiffScratchList
+			else
+				let index = index(s:vimDiffScratchList, a:vimDiffBuff)
+				if index >= 0
+					call remove(s:vimDiffScratchList, index)
+					if len(s:vimDiffScratchList) == 0
+						if exists('s:vimDiffRestoreCmd')
+							" All scratch buffers are gone, reset the original.
+							" Only restore if the source buffer is still in Diff mode
+
+							let sourceWinNR = bufwinnr(s:vimDiffSourceBuffer)
+							if sourceWinNR != -1
+								" The buffer is visible in at least one window
+								let currentWinNR = winnr()
+								while winbufnr(sourceWinNR) != -1
+									if winbufnr(sourceWinNR) == s:vimDiffSourceBuffer
+										execute sourceWinNR . 'wincmd w'
+										if getwinvar(0, '&diff')
+											execute s:vimDiffRestoreCmd
+										endif
+									endif
+									let sourceWinNR = sourceWinNR + 1
+								endwhile
+								execute currentWinNR . 'wincmd w'
+							else
+								" The buffer is hidden.  It must be visible in order to set the
+								" diff option.
+								let currentBufNR = bufnr('')
+								execute 'hide buffer' s:vimDiffSourceBuffer
+								if getwinvar(0, '&diff')
+									execute s:vimDiffRestoreCmd
+								endif
+								execute 'hide buffer' currentBufNR
+							endif
+
+							unlet s:vimDiffRestoreCmd
+						endif 
+						" All buffers are gone.
+						unlet s:vimDiffSourceBuffer
+						unlet s:vimDiffScratchList
+					endif
+				endif
+			endif
+		endif
+	finally
+		let s:isEditFileRunning -= 1
+	endtry
 endfunction
 
 " Section: Generic VCS command functions {{{1
 
 " Function: s:VCSCommit() {{{2
 function! s:VCSCommit(bang, message)
-  try
-    let vcsType = VCSCommandGetVCSType(bufnr('%'))
-    if !has_key(s:plugins, vcsType)
-      throw 'Unknown VCS type:  ' . vcsType
-    endif
-
-    let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-
-    " Handle the commit message being specified.  If a message is supplied, it
-    " is used; if bang is supplied, an empty message is used; otherwise, the
-    " user is provided a buffer from which to edit the commit message.
-
-    if strlen(a:message) > 0 || a:bang == '!'
-      return s:VCSFinishCommit([a:message], originalBuffer)
-    endif
-
-    call s:EditFile('commitlog', originalBuffer, '')
-    set ft=vcscommit
-
-    " Create a commit mapping.
-
-    nnoremap <silent> <buffer> <Plug>VCSCommit :call <SID>VCSFinishCommitWithBuffer()<CR>
-
-    silent 0put ='VCS: ----------------------------------------------------------------------'
-    silent put ='VCS: Please enter log message.  Lines beginning with ''VCS:'' are removed automatically.'
-    silent put ='VCS: To finish the commit, Type <leader>cc (or your own <Plug>VCSCommit mapping)'
-
-    if VCSCommandGetOption('VCSCommandCommitOnWrite', 1) == 1
-      set buftype=acwrite
-      au VCSCommandCommit BufWriteCmd <buffer> call s:VCSFinishCommitWithBuffer()
-      silent put ='VCS: or write this buffer'
-    endif
-
-    silent put ='VCS: ----------------------------------------------------------------------'
-    $
-    set nomodified
-  catch
-    call s:ReportError(v:exception)
-    return -1
-  endtry
+	try
+		let vcsType = VCSCommandGetVCSType(bufnr('%'))
+		if !has_key(s:plugins, vcsType)
+			throw 'Unknown VCS type:  ' . vcsType
+		endif
+
+		let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+
+		" Handle the commit message being specified.  If a message is supplied, it
+		" is used; if bang is supplied, an empty message is used; otherwise, the
+		" user is provided a buffer from which to edit the commit message.
+
+		if strlen(a:message) > 0 || a:bang == '!'
+			return s:VCSFinishCommit([a:message], originalBuffer)
+		endif
+
+		call s:EditFile('commitlog', originalBuffer, '')
+		set ft=vcscommit
+
+		" Create a commit mapping.
+
+		nnoremap <silent> <buffer> <Plug>VCSCommit :call <SID>VCSFinishCommitWithBuffer()<CR>
+
+		silent 0put ='VCS: ----------------------------------------------------------------------'
+		silent put ='VCS: Please enter log message.  Lines beginning with ''VCS:'' are removed automatically.'
+		silent put ='VCS: To finish the commit, Type <leader>cc (or your own <Plug>VCSCommit mapping)'
+
+		if VCSCommandGetOption('VCSCommandCommitOnWrite', 1) == 1
+			set buftype=acwrite
+			au VCSCommandCommit BufWriteCmd <buffer> call s:VCSFinishCommitWithBuffer()
+			silent put ='VCS: or write this buffer'
+		endif
+
+		silent put ='VCS: ----------------------------------------------------------------------'
+		$
+		set nomodified
+	catch
+		call s:ReportError(v:exception)
+		return -1
+	endtry
 endfunction
 
 " Function: s:VCSFinishCommitWithBuffer() {{{2
@@ -650,178 +665,178 @@
 " which removes all lines starting with 'VCS:'.
 
 function! s:VCSFinishCommitWithBuffer()
-  set nomodified
-  let currentBuffer = bufnr('%') 
-  let logMessageList = getbufline('%', 1, '$')
-  call filter(logMessageList, 'v:val !~ ''^\s*VCS:''')
-  let resultBuffer = s:VCSFinishCommit(logMessageList, b:VCSCommandOriginalBuffer)
-  if resultBuffer >= 0
-    execute 'bw' currentBuffer
-  endif
-  return resultBuffer
+	set nomodified
+	let currentBuffer = bufnr('%') 
+	let logMessageList = getbufline('%', 1, '$')
+	call filter(logMessageList, 'v:val !~ ''^\s*VCS:''')
+	let resultBuffer = s:VCSFinishCommit(logMessageList, b:VCSCommandOriginalBuffer)
+	if resultBuffer >= 0
+		execute 'bw' currentBuffer
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:VCSFinishCommit(logMessageList, originalBuffer) {{{2
 function! s:VCSFinishCommit(logMessageList, originalBuffer)
-  let shellSlashBak = &shellslash
-  try
-    set shellslash
-    let messageFileName = tempname()
-    call writefile(a:logMessageList, messageFileName)
-    try
-      let resultBuffer = s:ExecuteVCSCommand('Commit', [messageFileName])
-      if resultBuffer < 0
-        return resultBuffer
-      endif
-      return s:MarkOrigBufferForSetup(resultBuffer)
-    finally
-      call delete(messageFileName)
-    endtry
-  finally
-    let &shellslash = shellSlashBak
-  endtry
+	let shellSlashBak = &shellslash
+	try
+		set shellslash
+		let messageFileName = tempname()
+		call writefile(a:logMessageList, messageFileName)
+		try
+			let resultBuffer = s:ExecuteVCSCommand('Commit', [messageFileName])
+			if resultBuffer < 0
+				return resultBuffer
+			endif
+			return s:MarkOrigBufferForSetup(resultBuffer)
+		finally
+			call delete(messageFileName)
+		endtry
+	finally
+		let &shellslash = shellSlashBak
+	endtry
 endfunction
 
 " Function: s:VCSGotoOriginal(bang) {{{2
 function! s:VCSGotoOriginal(bang)
-  let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-  if originalBuffer > 0
-    let origWinNR = bufwinnr(originalBuffer)
-    if origWinNR == -1
-      execute 'buffer' originalBuffer
-    else
-      execute origWinNR . 'wincmd w'
-    endif
-    if a:bang == '!'
-      let buffnr = 1
-      let buffmaxnr = bufnr('$')
-      while buffnr <= buffmaxnr
-        if getbufvar(buffnr, 'VCSCommandOriginalBuffer') == originalBuffer
-          execute 'bw' buffnr
-        endif
-        let buffnr = buffnr + 1
-      endwhile
-    endif
-  endif
+	let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+	if originalBuffer > 0
+		let origWinNR = bufwinnr(originalBuffer)
+		if origWinNR == -1
+			execute 'buffer' originalBuffer
+		else
+			execute origWinNR . 'wincmd w'
+		endif
+		if a:bang == '!'
+			let buffnr = 1
+			let buffmaxnr = bufnr('$')
+			while buffnr <= buffmaxnr
+				if getbufvar(buffnr, 'VCSCommandOriginalBuffer') == originalBuffer
+					execute 'bw' buffnr
+				endif
+				let buffnr = buffnr + 1
+			endwhile
+		endif
+	endif
 endfunction
 
 " Function: s:VCSVimDiff(...) {{{2
 function! s:VCSVimDiff(...)
-  try
-    let vcsType = VCSCommandGetVCSType(bufnr('%'))
-    if !has_key(s:plugins, vcsType)
-      throw 'Unknown VCS type:  ' . vcsType
-    endif
-    let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-    let s:isEditFileRunning = s:isEditFileRunning + 1
-    try
-      " If there's already a VimDiff'ed window, restore it.
-      " There may only be one VCSVimDiff original window at a time.
-
-      if exists('s:vimDiffSourceBuffer') && s:vimDiffSourceBuffer != originalBuffer
-        " Clear the existing vimdiff setup by removing the result buffers.
-        call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
-      endif
-
-      " Split and diff
-      if(a:0 == 2)
-        " Reset the vimdiff system, as 2 explicit versions were provided.
-        if exists('s:vimDiffSourceBuffer')
-          call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
-        endif
-        let resultBuffer = s:plugins[vcsType][1].Review([a:1])
-        if resultBuffer < 0
-          echomsg 'Can''t open revision ' . a:1
-          return resultBuffer
-        endif
-        let b:VCSCommandCommand = 'vimdiff'
-        diffthis
-        let s:vimDiffScratchList = [resultBuffer]
-        " If no split method is defined, cheat, and set it to vertical.
-        try
-          call s:OverrideOption('VCSCommandSplit', VCSCommandGetOption('VCSCommandDiffSplit', VCSCommandGetOption('VCSCommandSplit', 'vertical')))
-          let resultBuffer = s:plugins[vcsType][1].Review([a:2])
-        finally
-          call s:OverrideOption('VCSCommandSplit')
-        endtry
-        if resultBuffer < 0
-          echomsg 'Can''t open revision ' . a:1
-          return resultBuffer
-        endif
-        let b:VCSCommandCommand = 'vimdiff'
-        diffthis
-        let s:vimDiffScratchList += [resultBuffer]
-      else
-        " Add new buffer
-        call s:OverrideOption('VCSCommandEdit', 'split')
-        try
-          " Force splitting behavior, otherwise why use vimdiff?
-          call s:OverrideOption('VCSCommandSplit', VCSCommandGetOption('VCSCommandDiffSplit', VCSCommandGetOption('VCSCommandSplit', 'vertical')))
-          try
-            if(a:0 == 0)
-              let resultBuffer = s:plugins[vcsType][1].Review([])
-            else
-              let resultBuffer = s:plugins[vcsType][1].Review([a:1])
-            endif
-          finally
-            call s:OverrideOption('VCSCommandSplit')
-          endtry
-        finally
-          call s:OverrideOption('VCSCommandEdit')
-        endtry
-        if resultBuffer < 0
-          echomsg 'Can''t open current revision'
-          return resultBuffer
-        endif
-        let b:VCSCommandCommand = 'vimdiff'
-        diffthis
-
-        if !exists('s:vimDiffSourceBuffer')
-          " New instance of vimdiff.
-          let s:vimDiffScratchList = [resultBuffer]
-
-          " This could have been invoked on a VCS result buffer, not the
-          " original buffer.
-          wincmd W
-          execute 'buffer' originalBuffer
-          " Store info for later original buffer restore
-          let s:vimDiffRestoreCmd = 
-                \    'call setbufvar('.originalBuffer.', ''&diff'', '.getbufvar(originalBuffer, '&diff').')'
-                \ . '|call setbufvar('.originalBuffer.', ''&foldcolumn'', '.getbufvar(originalBuffer, '&foldcolumn').')'
-                \ . '|call setbufvar('.originalBuffer.', ''&foldenable'', '.getbufvar(originalBuffer, '&foldenable').')'
-                \ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')'
-                \ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
-                \ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
-                \ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
-                \ . '|if &foldmethod==''manual''|execute ''normal zE''|endif'
-          diffthis
-          wincmd w
-        else
-          " Adding a window to an existing vimdiff
-          let s:vimDiffScratchList += [resultBuffer]
-        endif
-      endif
-
-      let s:vimDiffSourceBuffer = originalBuffer
-
-      " Avoid executing the modeline in the current buffer after the autocommand.
-
-      let currentBuffer = bufnr('%')
-      let saveModeline = getbufvar(currentBuffer, '&modeline')
-      try
-        call setbufvar(currentBuffer, '&modeline', 0)
-        silent do VCSCommand User VCSVimDiffFinish
-      finally
-        call setbufvar(currentBuffer, '&modeline', saveModeline)
-      endtry
-      return resultBuffer
-    finally
-      let s:isEditFileRunning = s:isEditFileRunning - 1
-    endtry
-  catch
-    call s:ReportError(v:exception)
-    return -1
-  endtry
+	try
+		let vcsType = VCSCommandGetVCSType(bufnr('%'))
+		if !has_key(s:plugins, vcsType)
+			throw 'Unknown VCS type:  ' . vcsType
+		endif
+		let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+		let s:isEditFileRunning = s:isEditFileRunning + 1
+		try
+			" If there's already a VimDiff'ed window, restore it.
+			" There may only be one VCSVimDiff original window at a time.
+
+			if exists('s:vimDiffSourceBuffer') && s:vimDiffSourceBuffer != originalBuffer
+				" Clear the existing vimdiff setup by removing the result buffers.
+				call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
+			endif
+
+			" Split and diff
+			if(a:0 == 2)
+				" Reset the vimdiff system, as 2 explicit versions were provided.
+				if exists('s:vimDiffSourceBuffer')
+					call s:WipeoutCommandBuffers(s:vimDiffSourceBuffer, 'vimdiff')
+				endif
+				let resultBuffer = s:plugins[vcsType][1].Review([a:1])
+				if resultBuffer < 0
+					echomsg 'Can''t open revision ' . a:1
+					return resultBuffer
+				endif
+				let b:VCSCommandCommand = 'vimdiff'
+				diffthis
+				let s:vimDiffScratchList = [resultBuffer]
+				" If no split method is defined, cheat, and set it to vertical.
+				try
+					call s:OverrideOption('VCSCommandSplit', VCSCommandGetOption('VCSCommandDiffSplit', VCSCommandGetOption('VCSCommandSplit', 'vertical')))
+					let resultBuffer = s:plugins[vcsType][1].Review([a:2])
+				finally
+					call s:OverrideOption('VCSCommandSplit')
+				endtry
+				if resultBuffer < 0
+					echomsg 'Can''t open revision ' . a:1
+					return resultBuffer
+				endif
+				let b:VCSCommandCommand = 'vimdiff'
+				diffthis
+				let s:vimDiffScratchList += [resultBuffer]
+			else
+				" Add new buffer
+				call s:OverrideOption('VCSCommandEdit', 'split')
+				try
+					" Force splitting behavior, otherwise why use vimdiff?
+					call s:OverrideOption('VCSCommandSplit', VCSCommandGetOption('VCSCommandDiffSplit', VCSCommandGetOption('VCSCommandSplit', 'vertical')))
+					try
+						if(a:0 == 0)
+							let resultBuffer = s:plugins[vcsType][1].Review([])
+						else
+							let resultBuffer = s:plugins[vcsType][1].Review([a:1])
+						endif
+					finally
+						call s:OverrideOption('VCSCommandSplit')
+					endtry
+				finally
+					call s:OverrideOption('VCSCommandEdit')
+				endtry
+				if resultBuffer < 0
+					echomsg 'Can''t open current revision'
+					return resultBuffer
+				endif
+				let b:VCSCommandCommand = 'vimdiff'
+				diffthis
+
+				if !exists('s:vimDiffSourceBuffer')
+					" New instance of vimdiff.
+					let s:vimDiffScratchList = [resultBuffer]
+
+					" This could have been invoked on a VCS result buffer, not the
+					" original buffer.
+					wincmd W
+					execute 'buffer' originalBuffer
+					" Store info for later original buffer restore
+					let s:vimDiffRestoreCmd = 
+								\    'call setbufvar('.originalBuffer.', ''&diff'', '.getbufvar(originalBuffer, '&diff').')'
+								\ . '|call setbufvar('.originalBuffer.', ''&foldcolumn'', '.getbufvar(originalBuffer, '&foldcolumn').')'
+								\ . '|call setbufvar('.originalBuffer.', ''&foldenable'', '.getbufvar(originalBuffer, '&foldenable').')'
+								\ . '|call setbufvar('.originalBuffer.', ''&foldmethod'', '''.getbufvar(originalBuffer, '&foldmethod').''')'
+								\ . '|call setbufvar('.originalBuffer.', ''&foldlevel'', '''.getbufvar(originalBuffer, '&foldlevel').''')'
+								\ . '|call setbufvar('.originalBuffer.', ''&scrollbind'', '.getbufvar(originalBuffer, '&scrollbind').')'
+								\ . '|call setbufvar('.originalBuffer.', ''&wrap'', '.getbufvar(originalBuffer, '&wrap').')'
+								\ . '|if &foldmethod==''manual''|execute ''normal zE''|endif'
+					diffthis
+					wincmd w
+				else
+					" Adding a window to an existing vimdiff
+					let s:vimDiffScratchList += [resultBuffer]
+				endif
+			endif
+
+			let s:vimDiffSourceBuffer = originalBuffer
+
+			" Avoid executing the modeline in the current buffer after the autocommand.
+
+			let currentBuffer = bufnr('%')
+			let saveModeline = getbufvar(currentBuffer, '&modeline')
+			try
+				call setbufvar(currentBuffer, '&modeline', 0)
+				silent do VCSCommand User VCSVimDiffFinish
+			finally
+				call setbufvar(currentBuffer, '&modeline', saveModeline)
+			endtry
+			return resultBuffer
+		finally
+			let s:isEditFileRunning = s:isEditFileRunning - 1
+		endtry
+	catch
+		call s:ReportError(v:exception)
+		return -1
+	endtry
 endfunction
 
 " Section: Public functions {{{1
@@ -829,42 +844,61 @@
 " Function: VCSCommandGetVCSType() {{{2
 " Sets the b:VCSCommandVCSType variable in the given buffer to the
 " appropriate source control system name.
+"
+" This uses the Identify extension function to test the buffer.  If the
+" Identify function returns VCSCOMMAND_IDENTIFY_EXACT, the match is considered
+" exact.  If the Identify function returns VCSCOMMAND_IDENTIFY_INEXACT, the
+" match is considered inexact, and is only applied if no exact match is found.
+" Multiple inexact matches is currently considered an error.
 
 function! VCSCommandGetVCSType(buffer)
-  let vcsType = getbufvar(a:buffer, 'VCSCommandVCSType')
-  if strlen(vcsType) > 0
-    return vcsType
-  endif
-  for vcsType in keys(s:plugins)
-    if s:plugins[vcsType][1].Identify(a:buffer)
-      call setbufvar(a:buffer, 'VCSCommandVCSType', vcsType)
-      return vcsType
-    endif
-  endfor
-  throw 'No suitable plugin'
+	let vcsType = getbufvar(a:buffer, 'VCSCommandVCSType')
+	if strlen(vcsType) > 0
+		return vcsType
+	endif
+	let matches = []
+	for vcsType in keys(s:plugins)
+		let identified = s:plugins[vcsType][1].Identify(a:buffer)
+		if identified
+			if identified == g:VCSCOMMAND_IDENTIFY_EXACT
+				let matches = [vcsType]
+				break
+			else
+				let matches += [vcsType]
+			endif
+		endif
+	endfor
+	if len(matches) == 1
+		call setbufvar(a:buffer, 'VCSCommandVCSType', matches[0])
+		return matches[0]
+	elseif len(matches) == 0
+		throw 'No suitable plugin'
+	else
+		throw 'Too many matching VCS:  ' . join(matches)
+	endif
 endfunction
 
 " Function: VCSCommandChdir(directory) {{{2
 " Changes the current directory, respecting :lcd changes.
 
 function! VCSCommandChdir(directory)
-  let command = 'cd'
-  if exists("*haslocaldir") && haslocaldir()
-    let command = 'lcd'
-  endif
-  execute command escape(a:directory, ' ')
+	let command = 'cd'
+	if exists("*haslocaldir") && haslocaldir()
+		let command = 'lcd'
+	endif
+	execute command escape(a:directory, ' ')
 endfunction
 
 " Function: VCSCommandChangeToCurrentFileDir() {{{2
 " Go to the directory in which the given file is located.
 
 function! VCSCommandChangeToCurrentFileDir(fileName)
-  let oldCwd = getcwd()
-  let newCwd = fnamemodify(resolve(a:fileName), ':p:h')
-  if strlen(newCwd) > 0
-    call VCSCommandChdir(newCwd)
-  endif
-  return oldCwd
+	let oldCwd = getcwd()
+	let newCwd = fnamemodify(resolve(a:fileName), ':p:h')
+	if strlen(newCwd) > 0
+		call VCSCommandChdir(newCwd)
+	endif
+	return oldCwd
 endfunction
 
 " Function: VCSCommandGetOriginalBuffer(vcsBuffer) {{{2
@@ -872,118 +906,128 @@
 " for a given buffer.
 
 function! VCSCommandGetOriginalBuffer(vcsBuffer)
-  let origBuffer = getbufvar(a:vcsBuffer, 'VCSCommandOriginalBuffer')
-  if origBuffer
-    if bufexists(origBuffer)
-      return origBuffer
-    else
-      " Original buffer no longer exists.
-      throw 'Original buffer for this VCS buffer no longer exists.'
-    endif
-  else
-    " No original buffer
-    return a:vcsBuffer
-  endif
+	let origBuffer = getbufvar(a:vcsBuffer, 'VCSCommandOriginalBuffer')
+	if origBuffer
+		if bufexists(origBuffer)
+			return origBuffer
+		else
+			" Original buffer no longer exists.
+			throw 'Original buffer for this VCS buffer no longer exists.'
+		endif
+	else
+		" No original buffer
+		return a:vcsBuffer
+	endif
 endfunction
 
 " Function: VCSCommandRegisterModule(name, file, commandMap) {{{2
 " Allows VCS modules to register themselves.
 
 function! VCSCommandRegisterModule(name, path, commandMap, mappingMap)
-  let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap]
-  if !empty(a:mappingMap)
-        \ && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
-        \ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0)
-    for mapname in keys(a:mappingMap)
-      execute 'noremap <silent> <Leader>' . mapname ':call <SID>ExecuteExtensionMapping(''' . mapname . ''')<CR>'
-    endfor
-  endif
-endfunction
-
-" Function: VCSCommandDoCommand(cmd, cmdName, statusText) {{{2
+	let s:plugins[a:name] = [a:path, a:commandMap, a:mappingMap]
+	if !empty(a:mappingMap)
+				\ && !VCSCommandGetOption('VCSCommandDisableMappings', 0)
+				\ && !VCSCommandGetOption('VCSCommandDisableExtensionMappings', 0)
+		for mapname in keys(a:mappingMap)
+			execute 'noremap <silent> <Leader>' . mapname ':call <SID>ExecuteExtensionMapping(''' . mapname . ''')<CR>'
+		endfor
+	endif
+endfunction
+
+" Function: VCSCommandDoCommand(cmd, cmdName, statusText, [options]) {{{2
 " General skeleton for VCS function execution.  The given command is executed
 " after appending the current buffer name (or substituting it for
 " <VCSCOMMANDFILE>, if such a token is present).  The output is captured in a
 " new buffer.
+"
+" The optional 'options' Dictionary may contain the following options:
+" 	allowNonZeroExit:  if non-zero, if the underlying VCS command has a
+"		non-zero exit status, the command is still considered
+"		successfuly.  This defaults to zero.
 " Returns: name of the new command buffer containing the command results
 
-function! VCSCommandDoCommand(cmd, cmdName, statusText)
-  let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-  if originalBuffer == -1 
-    throw 'Original buffer no longer exists, aborting.'
-  endif
-
-  let path = resolve(bufname(originalBuffer))
-
-  " Work with netrw or other systems where a directory listing is displayed in
-  " a buffer.
-
-  if isdirectory(path)
-    let fileName = '.'
-  else
-    let fileName = fnamemodify(path, ':t')
-  endif
-
-  if match(a:cmd, '<VCSCOMMANDFILE>') > 0
-	  let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
-  else
-	  let fullCmd = a:cmd . ' "' . fileName . '"'
-  endif
-
-  " Change to the directory of the current buffer.  This is done for CVS, but
-  " is left in for other systems as it does not affect them negatively.
-
-  let oldCwd = VCSCommandChangeToCurrentFileDir(path)
-  try
-    let output = system(fullCmd)
-  finally
-    call VCSCommandChdir(oldCwd)
-  endtry
-
-  " HACK:  if line endings in the repository have been corrupted, the output
-  " of the command will be confused.
-  let output = substitute(output, "\r", '', 'g')
-
-  " HACK:  CVS diff command does not return proper error codes
-  if v:shell_error && (a:cmdName != 'diff' || getbufvar(originalBuffer, 'VCSCommandVCSType') != 'CVS')
-    if strlen(output) == 0
-      throw 'Version control command failed'
-    else
-      let output = substitute(output, '\n', '  ', 'g')
-      throw 'Version control command failed:  ' . output
-    endif
-  endif
-  if strlen(output) == 0
-    " Handle case of no output.  In this case, it is important to check the
-    " file status, especially since cvs edit/unedit may change the attributes
-    " of the file with no visible output.
-
-    checktime
-    return 0
-  endif
-
-  call s:EditFile(a:cmdName, originalBuffer, a:statusText)
-
-  silent 0put=output
-
-  " The last command left a blank line at the end of the buffer.  If the
-  " last line is folded (a side effect of the 'put') then the attempt to
-  " remove the blank line will kill the last fold.
-  "
-  " This could be fixed by explicitly detecting whether the last line is
-  " within a fold, but I prefer to simply unfold the result buffer altogether.
-
-  if has('folding')
-    normal zR
-  endif
-
-  $d
-  1
-
-  " Define the environment and execute user-defined hooks.
-
-  silent do VCSCommand User VCSBufferCreated
-  return bufnr('%')
+function! VCSCommandDoCommand(cmd, cmdName, statusText, options)
+	let allowNonZeroExit = 0
+	if has_key(a:options, 'allowNonZeroExit')
+		let allowNonZeroExit = a:options.allowNonZeroExit
+	endif
+
+	let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+	if originalBuffer == -1 
+		throw 'Original buffer no longer exists, aborting.'
+	endif
+
+	let path = resolve(bufname(originalBuffer))
+
+	" Work with netrw or other systems where a directory listing is displayed in
+	" a buffer.
+
+	if isdirectory(path)
+		let fileName = '.'
+	else
+		let fileName = fnamemodify(path, ':t')
+	endif
+
+	if match(a:cmd, '<VCSCOMMANDFILE>') > 0
+		let fullCmd = substitute(a:cmd, '<VCSCOMMANDFILE>', fileName, 'g')
+	else
+		let fullCmd = a:cmd . ' "' . fileName . '"'
+	endif
+
+	" Change to the directory of the current buffer.  This is done for CVS, but
+	" is left in for other systems as it does not affect them negatively.
+
+	let oldCwd = VCSCommandChangeToCurrentFileDir(path)
+	try
+		let output = system(fullCmd)
+	finally
+		call VCSCommandChdir(oldCwd)
+	endtry
+
+	" HACK:  if line endings in the repository have been corrupted, the output
+	" of the command will be confused.
+	let output = substitute(output, "\r", '', 'g')
+
+	if v:shell_error && !allowNonZeroExit
+		if strlen(output) == 0
+			throw 'Version control command failed'
+		else
+			let output = substitute(output, '\n', '  ', 'g')
+			throw 'Version control command failed:  ' . output
+		endif
+	endif
+
+	if strlen(output) == 0
+		" Handle case of no output.  In this case, it is important to check the
+		" file status, especially since cvs edit/unedit may change the attributes
+		" of the file with no visible output.
+
+		checktime
+		return 0
+	endif
+
+	call s:EditFile(a:cmdName, originalBuffer, a:statusText)
+
+	silent 0put=output
+
+	" The last command left a blank line at the end of the buffer.  If the
+	" last line is folded (a side effect of the 'put') then the attempt to
+	" remove the blank line will kill the last fold.
+	"
+	" This could be fixed by explicitly detecting whether the last line is
+	" within a fold, but I prefer to simply unfold the result buffer altogether.
+
+	if has('folding')
+		normal zR
+	endif
+
+	$d
+	1
+
+	" Define the environment and execute user-defined hooks.
+
+	silent do VCSCommand User VCSBufferCreated
+	return bufnr('%')
 endfunction
 
 " Function: VCSCommandGetOption(name, default) {{{2
@@ -991,42 +1035,42 @@
 " searched in the window, buffer, then global spaces.
 
 function! VCSCommandGetOption(name, default)
-  if has_key(s:optionOverrides, a:name) && len(s:optionOverrides[a:name]) > 0
-    return s:optionOverrides[a:name][-1]
-  elseif exists('w:' . a:name)
-    return w:{a:name}
-  elseif exists('b:' . a:name)
-    return b:{a:name}
-  elseif exists('g:' . a:name)
-    return g:{a:name}
-  else
-    return a:default
-  endif
+	if has_key(s:optionOverrides, a:name) && len(s:optionOverrides[a:name]) > 0
+		return s:optionOverrides[a:name][-1]
+	elseif exists('w:' . a:name)
+		return w:{a:name}
+	elseif exists('b:' . a:name)
+		return b:{a:name}
+	elseif exists('g:' . a:name)
+		return g:{a:name}
+	else
+		return a:default
+	endif
 endfunction
 
 " Function: VCSCommandDisableBufferSetup() {{{2
 " Global function for deactivating the buffer autovariables.
 
 function! VCSCommandDisableBufferSetup()
-  let g:VCSCommandEnableBufferSetup = 0
-  silent! augroup! VCSCommandPlugin
+	let g:VCSCommandEnableBufferSetup = 0
+	silent! augroup! VCSCommandPlugin
 endfunction
 
 " Function: VCSCommandEnableBufferSetup() {{{2
 " Global function for activating the buffer autovariables.
 
 function! VCSCommandEnableBufferSetup()
-  let g:VCSCommandEnableBufferSetup = 1
-  augroup VCSCommandPlugin
-    au!
-    au BufEnter * call s:SetupBuffer()
-  augroup END
-
-  " Only auto-load if the plugin is fully loaded.  This gives other plugins a
-  " chance to run.
-  if g:loaded_VCSCommand == 2
-    call s:SetupBuffer()
-  endif
+	let g:VCSCommandEnableBufferSetup = 1
+	augroup VCSCommandPlugin
+		au!
+		au BufEnter * call s:SetupBuffer()
+	augroup END
+
+	" Only auto-load if the plugin is fully loaded.  This gives other plugins a
+	" chance to run.
+	if g:loaded_VCSCommand == 2
+		call s:SetupBuffer()
+	endif
 endfunction
 
 " Function: VCSCommandGetStatusLine() {{{2
@@ -1035,20 +1079,20 @@
 " variable for how to do this).
 
 function! VCSCommandGetStatusLine()
-  if exists('b:VCSCommandCommand')
-    " This is a result buffer.  Return nothing because the buffer name
-    " contains information already.
-    return ''
-  endif
-
-  if exists('b:VCSCommandVCSType')
-        \ && exists('g:VCSCommandEnableBufferSetup')
-        \ && g:VCSCommandEnableBufferSetup
-        \ && exists('b:VCSCommandBufferInfo')
-    return '[' . join(extend([b:VCSCommandVCSType], b:VCSCommandBufferInfo), ' ') . ']'
-  else
-    return ''
-  endif
+	if exists('b:VCSCommandCommand')
+		" This is a result buffer.  Return nothing because the buffer name
+		" contains information already.
+		return ''
+	endif
+
+	if exists('b:VCSCommandVCSType')
+				\ && exists('g:VCSCommandEnableBufferSetup')
+				\ && g:VCSCommandEnableBufferSetup
+				\ && exists('b:VCSCommandBufferInfo')
+		return '[' . join(extend([b:VCSCommandVCSType], b:VCSCommandBufferInfo), ' ') . ']'
+	else
+		return ''
+	endif
 endfunction
 
 " Section: Command definitions {{{1
@@ -1099,54 +1143,54 @@
 " Section: Default mappings {{{1
 
 if !VCSCommandGetOption('VCSCommandDisableMappings', 0)
-  if !hasmapto('<Plug>VCSAdd')
-    nmap <unique> <Leader>ca <Plug>VCSAdd
-  endif
-  if !hasmapto('<Plug>VCSAnnotate')
-    nmap <unique> <Leader>cn <Plug>VCSAnnotate
-  endif
-  if !hasmapto('<Plug>VCSClearAndGotoOriginal')
-    nmap <unique> <Leader>cG <Plug>VCSClearAndGotoOriginal
-  endif
-  if !hasmapto('<Plug>VCSCommit')
-    nmap <unique> <Leader>cc <Plug>VCSCommit
-  endif
-  if !hasmapto('<Plug>VCSDelete')
-    nmap <unique> <Leader>cD <Plug>VCSDelete
-  endif
-  if !hasmapto('<Plug>VCSDiff')
-    nmap <unique> <Leader>cd <Plug>VCSDiff
-  endif
-  if !hasmapto('<Plug>VCSGotoOriginal')
-    nmap <unique> <Leader>cg <Plug>VCSGotoOriginal
-  endif
-  if !hasmapto('<Plug>VCSInfo')
-    nmap <unique> <Leader>ci <Plug>VCSInfo
-  endif
-  if !hasmapto('<Plug>VCSLock')
-    nmap <unique> <Leader>cL <Plug>VCSLock
-  endif
-  if !hasmapto('<Plug>VCSLog')
-    nmap <unique> <Leader>cl <Plug>VCSLog
-  endif
-  if !hasmapto('<Plug>VCSRevert')
-    nmap <unique> <Leader>cq <Plug>VCSRevert
-  endif
-  if !hasmapto('<Plug>VCSReview')
-    nmap <unique> <Leader>cr <Plug>VCSReview
-  endif
-  if !hasmapto('<Plug>VCSStatus')
-    nmap <unique> <Leader>cs <Plug>VCSStatus
-  endif
-  if !hasmapto('<Plug>VCSUnlock')
-    nmap <unique> <Leader>cU <Plug>VCSUnlock
-  endif
-  if !hasmapto('<Plug>VCSUpdate')
-    nmap <unique> <Leader>cu <Plug>VCSUpdate
-  endif
-  if !hasmapto('<Plug>VCSVimDiff')
-    nmap <unique> <Leader>cv <Plug>VCSVimDiff
-  endif
+	if !hasmapto('<Plug>VCSAdd')
+		nmap <unique> <Leader>ca <Plug>VCSAdd
+	endif
+	if !hasmapto('<Plug>VCSAnnotate')
+		nmap <unique> <Leader>cn <Plug>VCSAnnotate
+	endif
+	if !hasmapto('<Plug>VCSClearAndGotoOriginal')
+		nmap <unique> <Leader>cG <Plug>VCSClearAndGotoOriginal
+	endif
+	if !hasmapto('<Plug>VCSCommit')
+		nmap <unique> <Leader>cc <Plug>VCSCommit
+	endif
+	if !hasmapto('<Plug>VCSDelete')
+		nmap <unique> <Leader>cD <Plug>VCSDelete
+	endif
+	if !hasmapto('<Plug>VCSDiff')
+		nmap <unique> <Leader>cd <Plug>VCSDiff
+	endif
+	if !hasmapto('<Plug>VCSGotoOriginal')
+		nmap <unique> <Leader>cg <Plug>VCSGotoOriginal
+	endif
+	if !hasmapto('<Plug>VCSInfo')
+		nmap <unique> <Leader>ci <Plug>VCSInfo
+	endif
+	if !hasmapto('<Plug>VCSLock')
+		nmap <unique> <Leader>cL <Plug>VCSLock
+	endif
+	if !hasmapto('<Plug>VCSLog')
+		nmap <unique> <Leader>cl <Plug>VCSLog
+	endif
+	if !hasmapto('<Plug>VCSRevert')
+		nmap <unique> <Leader>cq <Plug>VCSRevert
+	endif
+	if !hasmapto('<Plug>VCSReview')
+		nmap <unique> <Leader>cr <Plug>VCSReview
+	endif
+	if !hasmapto('<Plug>VCSStatus')
+		nmap <unique> <Leader>cs <Plug>VCSStatus
+	endif
+	if !hasmapto('<Plug>VCSUnlock')
+		nmap <unique> <Leader>cU <Plug>VCSUnlock
+	endif
+	if !hasmapto('<Plug>VCSUpdate')
+		nmap <unique> <Leader>cu <Plug>VCSUpdate
+	endif
+	if !hasmapto('<Plug>VCSVimDiff')
+		nmap <unique> <Leader>cv <Plug>VCSVimDiff
+	endif
 endif
 
 " Section: Menu items {{{1
@@ -1165,14 +1209,14 @@
 
 " Section: Autocommands to restore vimdiff state {{{1
 augroup VimDiffRestore
-  au!
-  au BufUnload * call s:VimDiffRestore(str2nr(expand('<abuf>')))
+	au!
+	au BufUnload * call s:VimDiffRestore(str2nr(expand('<abuf>')))
 augroup END
 
 " Section: Optional activation of buffer management {{{1
 
 if VCSCommandGetOption('VCSCommandEnableBufferSetup', 0)
-  call VCSCommandEnableBufferSetup()
+	call VCSCommandEnableBufferSetup()
 endif
 
 " Section: VIM shutdown hook {{{1
@@ -1183,21 +1227,21 @@
 " Function: s:CloseAllResultBuffers() {{{2
 " Closes all vcscommand result buffers.
 function! s:CloseAllResultBuffers()
-  " This avoids using bufdo as that may load buffers already loaded in another
-  " vim process, resulting in an error.
-  let buffnr = 1
-  let buffmaxnr = bufnr('$')
-  while buffnr <= buffmaxnr
-    if getbufvar(buffnr, 'VCSCommandOriginalBuffer') != "" 
-      execute 'bw' buffnr
-    endif
-    let buffnr = buffnr + 1
-  endwhile
+	" This avoids using bufdo as that may load buffers already loaded in another
+	" vim process, resulting in an error.
+	let buffnr = 1
+	let buffmaxnr = bufnr('$')
+	while buffnr <= buffmaxnr
+		if getbufvar(buffnr, 'VCSCommandOriginalBuffer') != "" 
+			execute 'bw' buffnr
+		endif
+		let buffnr = buffnr + 1
+	endwhile
 endfunction
 
 augroup VCSCommandVIMShutdown
-  au!
-  au VimLeavePre * call s:CloseAllResultBuffers()
+	au!
+	au VimLeavePre * call s:CloseAllResultBuffers()
 augroup END
 
 " Section: Plugin completion {{{1

Modified: trunk/packages/vim-scripts/plugin/vcscvs.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/vcscvs.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/plugin/vcscvs.vim (original)
+++ trunk/packages/vim-scripts/plugin/vcscvs.vim Tue Apr  8 21:07:01 2008
@@ -82,36 +82,36 @@
 " Section: Plugin header {{{1
 
 if v:version < 700
-  echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
-  finish
+	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
 
-runtime plugin/vcscommand.vim
-
-if !executable(VCSCommandGetOption('VCSCommandCVSExec', 'cvs'))
-  " CVS is not installed
-  finish
-endif
-
 " Section: Variable initialization {{{1
 
 let s:cvsFunctions = {}
 
 " Section: Utility functions {{{1
 
-" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
+" 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)
-  if VCSCommandGetVCSType(expand('%')) == 'CVS'
-    let fullCmd = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
-    return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText)
-  else
-    throw 'CVS VCSCommand plugin called on non-CVS item.'
-  endif
+function! s:DoCommand(cmd, cmdName, statusText, options)
+	if VCSCommandGetVCSType(expand('%')) == 'CVS'
+		let fullCmd = VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' ' . a:cmd
+		return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
+	else
+		throw 'CVS VCSCommand plugin called on non-CVS item.'
+	endif
 endfunction
 
 " Function: GetRevision() {{{2
@@ -119,139 +119,139 @@
 " Returns: Revision number or an empty string if an error occurs.
 
 function! GetRevision()
-  if !exists('b:VCSCommandBufferInfo')
-    let b:VCSCommandBufferInfo =  s:cvsFunctions.GetBufferInfo()
-  endif
-
-  if len(b:VCSCommandBufferInfo) > 0
-    return b:VCSCommandBufferInfo[0]
-  else
-    return ''
-  endif
+	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
+	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, ' '))
+	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' .  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
-    set filetype=CVSAnnotate
-    " Remove header lines from standard error
-    silent v/^\d\+\%(\.\d\+\)\+/d
-  endif
-  return resultBuffer
+	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' .  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
+		set filetype=CVSAnnotate
+		" 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
+	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)
+	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
-
-  let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption)
-  if resultBuffer > 0
-    set filetype=diff
-  else
-    echomsg 'No differences found'
-  endif
-  return resultBuffer
+	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
+
+	let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1})
+	if resultBuffer > 0
+		set filetype=diff
+	else
+		echomsg 'No differences found'
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:cvsFunctions.GetBufferInfo() {{{2
@@ -262,129 +262,129 @@
 " 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=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' 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
+	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=system(VCSCommandGetOption('VCSCommandCVSExec', 'cvs') . ' 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
-
-  let resultBuffer=s:DoCommand(join(['log'] + options), 'log', caption)
-  if resultBuffer > 0
-    set filetype=rcslog
-  endif
-  return resultBuffer
+	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'] + options), 'log', caption, {})
+	if resultBuffer > 0
+		set filetype=rcslog
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:cvsFunctions.Revert(argList) {{{2
 function! s:cvsFunctions.Revert(argList)
-  return s:DoCommand('update -C', 'revert', '')
+	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
-
-  let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag)
-  if resultBuffer > 0
-    let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
-  endif
-  return resultBuffer
+	if len(a:argList) == 0
+		let versiontag = '(current)'
+		let versionOption = ''
+	else
+		let versiontag = a:argList[0]
+		let versionOption = ' -r ' . versiontag . ' '
+	endif
+
+	let resultBuffer = s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {})
+	if resultBuffer > 0
+		let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:cvsFunctions.Status(argList) {{{2
 function! s:cvsFunctions.Status(argList)
-  return s:DoCommand(join(['status'] + a:argList, ' '), 'status', join(a: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', '')
+	return s:DoCommand('update', 'update', '', {})
 endfunction
 
 " Section: CVS-specific functions {{{1
 
 " Function: s:CVSEdit() {{{2
 function! s:CVSEdit()
-  return s:DoCommand('edit', 'cvsedit', '')
+	return s:DoCommand('edit', 'cvsedit', '', {})
 endfunction
 
 " Function: s:CVSEditors() {{{2
 function! s:CVSEditors()
-  return s:DoCommand('editors', 'cvseditors', '')
+	return s:DoCommand('editors', 'cvseditors', '', {})
 endfunction
 
 " Function: s:CVSUnedit() {{{2
 function! s:CVSUnedit()
-  return s:DoCommand('unedit', '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', '')
+	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', '')
+	return s:DoCommand('watchers', 'cvswatchers', '', {})
 endfunction
 
 " Section: Command definitions {{{1
@@ -403,21 +403,21 @@
 
 let s:cvsExtensionMappings = {}
 let mappingInfo = [
-      \['CVSEdit', 'CVSEdit', 'ce'],
-      \['CVSEditors', 'CVSEditors', 'cE'],
-      \['CVSUnedit', 'CVSUnedit', 'ct'],
-      \['CVSWatchers', 'CVSWatchers', 'cwv'],
-      \['CVSWatchAdd', 'CVSWatch add', 'cwa'],
-      \['CVSWatchOff', 'CVSWatch off', 'cwf'],
-      \['CVSWatchOn', 'CVSWatch on', 'cwn'],
-      \['CVSWatchRemove', 'CVSWatch remove', 'cwr']
-      \]
+			\['CVSEdit', 'CVSEdit', 'ce'],
+			\['CVSEditors', 'CVSEditors', 'cE'],
+			\['CVSUnedit', 'CVSUnedit', 'ct'],
+			\['CVSWatchers', 'CVSWatchers', 'cwv'],
+			\['CVSWatchAdd', 'CVSWatch add', 'cwa'],
+			\['CVSWatchOff', 'CVSWatch off', 'cwf'],
+			\['CVSWatchOn', 'CVSWatch on', 'cwn'],
+			\['CVSWatchRemove', 'CVSWatch remove', 'cwr']
+			\]
 
 for [pluginName, commandText, shortCut] in mappingInfo
-  execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
-  if !hasmapto('<Plug>' . pluginName)
-    let s:cvsExtensionMappings[shortCut] = commandText
-  endif
+	execute 'nnoremap <silent> <Plug>' . pluginName . ' :' . commandText . '<CR>'
+	if !hasmapto('<Plug>' . pluginName)
+		let s:cvsExtensionMappings[shortCut] = commandText
+	endif
 endfor
 
 " Section: Menu items {{{1

Modified: trunk/packages/vim-scripts/plugin/vcsgit.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/vcsgit.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/plugin/vcsgit.vim (original)
+++ trunk/packages/vim-scripts/plugin/vcsgit.vim Tue Apr  8 21:07:01 2008
@@ -45,9 +45,6 @@
 	finish
 endif
 
-let s:save_cpo=&cpo
-set cpo&vim
-
 runtime plugin/vcscommand.vim
 
 if !executable(VCSCommandGetOption('VCSCommandGitExec', 'git'))
@@ -55,19 +52,22 @@
 	finish
 endif
 
+let s:save_cpo=&cpo
+set cpo&vim
+
 " Section: Variable initialization {{{1
 
 let s:gitFunctions = {}
 
 " Section: Utility functions {{{1
 
-" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
+" 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)
+function! s:DoCommand(cmd, cmdName, statusText, options)
 	if VCSCommandGetVCSType(expand('%')) == 'git'
-		let fullCmd = VCSCommandGetOption('VCSCommandGitExec', 'git') . ' ' . a:cmd
-		return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText)
+		let fullCmd = VCSCommandGetOption('VCSCommandGitExec', 'git',) . ' ' . a:cmd
+		return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText, a:options)
 	else
 		throw 'git VCSCommand plugin called on non-git item.'
 	endif
@@ -76,6 +76,8 @@
 " 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
@@ -83,7 +85,7 @@
 		if(v:shell_error)
 			return 0
 		else
-			return 1
+			return g:VCSCOMMAND_IDENTIFY_INEXACT
 		endif
 	finally
 		call VCSCommandChdir(oldCwd)
@@ -92,7 +94,7 @@
 
 " Function: s:gitFunctions.Add(argList) {{{2
 function! s:gitFunctions.Add(argList)
-	return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '))
+	return s:DoCommand(join(['add'] + ['-v'] + a:argList, ' '), 'add', join(a:argList, ' '), {})
 endfunction
 
 " Function: s:gitFunctions.Annotate(argList) {{{2
@@ -110,7 +112,7 @@
 		let options = join(a:argList, ' ')
 	endif
 
-	let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options) 
+	let resultBuffer = s:DoCommand('blame ' . options . ' -- ', 'annotate', options, {})
 	if resultBuffer > 0
 		normal 1G
 		set filetype=gitAnnotate
@@ -120,7 +122,7 @@
 
 " Function: s:gitFunctions.Commit(argList) {{{2
 function! s:gitFunctions.Commit(argList)
-	let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '')
+	let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '', {})
 	if resultBuffer == 0
 		echomsg 'No commit needed.'
 	endif
@@ -132,7 +134,7 @@
 function! s:gitFunctions.Delete(argList)
 	let options = a:argList
 	let caption = join(a:argList, ' ')
-	return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption)
+	return s:DoCommand(join(['rm'] + options, ' '), 'delete', caption, {})
 endfunction
 
 " Function: s:gitFunctions.Diff(argList) {{{2
@@ -152,7 +154,7 @@
 		endfor
 	endif
 
-	let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList))
+	let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {})
 	if resultBuffer > 0
 		set filetype=diff
 	else
@@ -171,9 +173,27 @@
 function! s:gitFunctions.GetBufferInfo()
 	let oldCwd = VCSCommandChangeToCurrentFileDir(resolve(bufname('%')))
 	try
-		let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' symbolic-ref HEAD'), '\n$', '', '')
-		let branch = substitute(branch, '^refs/heads/', '', '')
-		return[branch]
+		let branch = substitute(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' 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(system(VCSCommandGetOption('VCSCommandGitExec', 'git') . ' describe' . method), '\n$', '', '')
+			if !v:shell_error
+				call add(info, tag)
+				break
+			endif
+		endfor
+
+		return info
 	finally
 		call VCSCommandChdir(oldCwd)
 	endtry
@@ -181,7 +201,7 @@
 
 " Function: s:gitFunctions.Log() {{{2
 function! s:gitFunctions.Log(argList)
-	let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '))
+	let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {})
 	if resultBuffer > 0
 		set filetype=gitlog
 	endif
@@ -190,7 +210,7 @@
 
 " Function: s:gitFunctions.Revert(argList) {{{2
 function! s:gitFunctions.Revert(argList)
-	return s:DoCommand('checkout', 'revert', '')
+	return s:DoCommand('checkout', 'revert', '', {})
 endfunction
 
 " Function: s:gitFunctions.Review(argList) {{{2
@@ -210,7 +230,7 @@
 
 	let prefix = substitute(prefix, '\n$', '', '')
 	let blob = revision . ':' . prefix . '<VCSCOMMANDFILE>' 
-	let resultBuffer = s:DoCommand('show ' . blob, 'review', revision)
+	let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {})
 	if resultBuffer > 0
 		let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
 	endif
@@ -219,7 +239,7 @@
 
 " Function: s:gitFunctions.Status(argList) {{{2
 function! s:gitFunctions.Status(argList)
-	throw "This command is not implemented for git.  If you have an idea for what it should do, please let me know."
+	return s:DoCommand(join(['status'] + a:argList), 'log', join(a:argList), {'allowNonZeroExit': 1})
 endfunction
 
 " Function: s:gitFunctions.Update(argList) {{{2

Modified: trunk/packages/vim-scripts/plugin/vcssvk.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/vcssvk.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/plugin/vcssvk.vim (original)
+++ trunk/packages/vim-scripts/plugin/vcssvk.vim Tue Apr  8 21:07:01 2008
@@ -36,122 +36,122 @@
 " Section: Plugin header {{{1
 
 if v:version < 700
-  echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
-  finish
+	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
 
-runtime plugin/vcscommand.vim
-
-if !executable(VCSCommandGetOption('VCSCommandSVKExec', 'svk'))
-  " SVK is not installed
-  finish
-endif
-
 " Section: Variable initialization {{{1
 
 let s:svkFunctions = {}
 
 " Section: Utility functions {{{1
 
-" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
+" 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)
-  if VCSCommandGetVCSType(expand('%')) == 'SVK'
-    let fullCmd = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . a:cmd
-    return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText)
-  else
-    throw 'SVK VCSCommand plugin called on non-SVK item.'
-  endif
+function! s:DoCommand(cmd, cmdName, statusText, options)
+	if VCSCommandGetVCSType(expand('%')) == 'SVK'
+		let fullCmd = VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' ' . 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 = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
-  if(v:shell_error)
-    return 0
-  else
-    return 1
-  endif
+	let fileName = resolve(bufname(a:buffer))
+	if isdirectory(fileName)
+		let directoryName = fileName
+	else
+		let directoryName = fnamemodify(fileName, ':p:h')
+	endif
+	let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' info "' . directoryName . '"')
+	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, ' '))
+	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
-    set filetype=SVKAnnotate
-  endif
-  return resultBuffer
+	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
+		set filetype=SVKAnnotate
+	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
+	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, ' '))
+	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
-
-  let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption)
-  if resultBuffer > 0
-    set filetype=diff
-  else
-    echomsg 'No differences found'
-  endif
-  return resultBuffer
+	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 resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {})
+	if resultBuffer > 0
+		set filetype=diff
+	else
+		echomsg 'No differences found'
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:svkFunctions.GetBufferInfo() {{{2
@@ -161,95 +161,95 @@
 " Returns: List of results:  [revision, repository]
 
 function! s:svkFunctions.GetBufferInfo()
-  let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-  let fileName = resolve(bufname(originalBuffer))
-  let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' 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
+	let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+	let fileName = resolve(bufname(originalBuffer))
+	let statusText = system(VCSCommandGetOption('VCSCommandSVKExec', 'svk') . ' 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, ' '))
+	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, ' '))
+	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
+	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', '')
+	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
-
-  let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag)
-  if resultBuffer > 0
-    let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
-  endif
-  return resultBuffer
+	if len(a:argList) == 0
+		let versiontag = '(current)'
+		let versionOption = ''
+	else
+		let versiontag = a:argList[0]
+		let versionOption = ' -r ' . versiontag . ' '
+	endif
+
+	let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
+	if resultBuffer > 0
+		let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
+	endif
+	return resultBuffer
 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, ' '))
+	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, ' '))
+	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', '')
+	return s:DoCommand('update', 'update', '', {})
 endfunction
 
 " Section: Plugin Registration {{{1

Modified: trunk/packages/vim-scripts/plugin/vcssvn.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/plugin/vcssvn.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/plugin/vcssvn.vim (original)
+++ trunk/packages/vim-scripts/plugin/vcssvn.vim Tue Apr  8 21:07:01 2008
@@ -43,141 +43,141 @@
 " Section: Plugin header {{{1
 
 if v:version < 700
-  echohl WarningMsg|echomsg 'VCSCommand requires at least VIM 7.0'|echohl None
-  finish
+	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
 
-runtime plugin/vcscommand.vim
-
-if !executable(VCSCommandGetOption('VCSCommandSVNExec', 'svn'))
-  " SVN is not installed
-  finish
-endif
-
 " Section: Variable initialization {{{1
 
 let s:svnFunctions = {}
 
 " Section: Utility functions {{{1
 
-" Function: s:DoCommand(cmd, cmdName, statusText) {{{2
+" 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)
-  if VCSCommandGetVCSType(expand('%')) == 'SVN'
-    let fullCmd = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . a:cmd
-    return VCSCommandDoCommand(fullCmd, a:cmdName, a:statusText)
-  else
-    throw 'SVN VCSCommand plugin called on non-SVN item.'
-  endif
+function! s:DoCommand(cmd, cmdName, statusText, options)
+	if VCSCommandGetVCSType(expand('%')) == 'SVN'
+		let fullCmd = VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' ' . 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
+	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, ' '))
+	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
-
-  let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption) 
-  if resultBuffer > 0
-    set filetype=SVNAnnotate
-  endif
-  return resultBuffer
+	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
+
+	let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {})
+	if resultBuffer > 0
+		set filetype=SVNAnnotate
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:svnFunctions.Commit(argList) {{{2
 function! s:svnFunctions.Commit(argList)
-  let resultBuffer = s:DoCommand('commit -F "' . a:argList[0] . '"', 'commit', '')
-  if resultBuffer == 0
-    echomsg 'No commit needed.'
-  endif
+	let resultBuffer = s:DoCommand('commit -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'] + a:argList, ' '), 'delete', join(a:argList, ' '))
+	return s:DoCommand(join(['delete'] + a:argList, ' '), 'delete', join(a:argList, ' '), {})
 endfunction
 
 " Function: s:svnFunctions.Diff(argList) {{{2
 function! s:svnFunctions.Diff(argList)
-  if len(a:argList) == 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
-
-  let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption)
-  if resultBuffer > 0
-    set filetype=diff
-  else
-    if svnDiffExt == ''
-      echomsg 'No differences found'
-    endif
-  endif
-  return resultBuffer
+	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
+
+	let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {})
+	if resultBuffer > 0
+		set filetype=diff
+	else
+		if svnDiffExt == ''
+			echomsg 'No differences found'
+		endif
+	endif
+	return resultBuffer
 endfunction
 
 " Function: s:svnFunctions.GetBufferInfo() {{{2
@@ -187,95 +187,95 @@
 " Returns: List of results:  [revision, repository, branch]
 
 function! s:svnFunctions.GetBufferInfo()
-  let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
-  let fileName = bufname(originalBuffer)
-  let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status -vu "' . fileName . '"')
-  if(v:shell_error)
-    return []
-  endif
-
-  " File not under SVN control.
-  if statusText =~ '^?'
-    return ['Unknown']
-  endif
-
-  let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\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
+	let originalBuffer = VCSCommandGetOriginalBuffer(bufnr('%'))
+	let fileName = bufname(originalBuffer)
+	let statusText = system(VCSCommandGetOption('VCSCommandSVNExec', 'svn') . ' status -vu "' . fileName . '"')
+	if(v:shell_error)
+		return []
+	endif
+
+	" File not under SVN control.
+	if statusText =~ '^?'
+		return ['Unknown']
+	endif
+
+	let [flags, revision, repository] = matchlist(statusText, '^\(.\{8}\)\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:svnFunctions.Info(argList) {{{2
 function! s:svnFunctions.Info(argList)
-  return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '))
+	return s:DoCommand(join(['info'] + a:argList, ' '), 'info', join(a:argList, ' '), {})
 endfunction
 
 " Function: s:svnFunctions.Lock(argList) {{{2
 function! s:svnFunctions.Lock(argList)
-  return s:DoCommand(join(['lock'] + a:argList, ' '), 'lock', join(a:argList, ' '))
+	return s:DoCommand(join(['lock'] + 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', '-v'] + options), 'log', caption)
-  return resultBuffer
+	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:svnFunctions.Revert(argList) {{{2
 function! s:svnFunctions.Revert(argList)
-  return s:DoCommand('revert', 'revert', '')
+	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
-
-  let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag)
-  if resultBuffer > 0
-    let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
-  endif
-  return resultBuffer
+	if len(a:argList) == 0
+		let versiontag = '(current)'
+		let versionOption = ''
+	else
+		let versiontag = a:argList[0]
+		let versionOption = ' -r ' . versiontag . ' '
+	endif
+
+	let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {})
+	if resultBuffer > 0
+		let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype')
+	endif
+	return resultBuffer
 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'] + options, ' '), 'status', join(options, ' '))
+	let options = ['-u', '-v']
+	if len(a:argList) == 0
+		let options = a:argList
+	endif
+	return s:DoCommand(join(['status'] + options, ' '), 'status', join(options, ' '), {})
 endfunction
 
 " Function: s:svnFunctions.Unlock(argList) {{{2
 function! s:svnFunctions.Unlock(argList)
-  return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '))
+	return s:DoCommand(join(['unlock'] + a:argList, ' '), 'unlock', join(a:argList, ' '), {})
 endfunction
 " Function: s:svnFunctions.Update(argList) {{{2
 function! s:svnFunctions.Update(argList)
-  return s:DoCommand('update', 'update', '')
+	return s:DoCommand('update', 'update', '', {})
 endfunction
 
 " Section: Plugin Registration {{{1

Modified: trunk/packages/vim-scripts/syntax/CVSAnnotate.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/syntax/CVSAnnotate.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/syntax/CVSAnnotate.vim (original)
+++ trunk/packages/vim-scripts/syntax/CVSAnnotate.vim Tue Apr  8 21:07:01 2008
@@ -25,9 +25,9 @@
 " IN THE SOFTWARE.
 
 if version < 600
-  syntax clear
+	syntax clear
 elseif exists("b:current_syntax")
-  finish
+	finish
 endif
 
 syn match cvsDate 	/\d\d-...-\d\d/ 		contained
@@ -36,10 +36,10 @@
 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
+	let did_cvsannotate_syntax_inits = 1
+	hi link cvsDate 	Comment
+	hi link cvsName	Type
+	hi link cvsVer	Statement
 endif
 
 let b:current_syntax="CVSAnnotate"

Modified: trunk/packages/vim-scripts/syntax/SVKAnnotate.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/syntax/SVKAnnotate.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/syntax/SVKAnnotate.vim (original)
+++ trunk/packages/vim-scripts/syntax/SVKAnnotate.vim Tue Apr  8 21:07:01 2008
@@ -24,7 +24,7 @@
 " IN THE SOFTWARE.
 
 if exists("b:current_syntax")
-  finish
+	finish
 endif
 
 syn match svkDate /\d\{4}-\d\{1,2}-\d\{1,2}/ skipwhite contained
@@ -33,10 +33,10 @@
 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
+	let did_svkannotate_syntax_inits = 1
+	hi link svkName Type
+	hi link svkDate Comment
+	hi link svkVer Statement
 endif
 
 let b:current_syntax="svkAnnotate"

Modified: trunk/packages/vim-scripts/syntax/SVNAnnotate.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/syntax/SVNAnnotate.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/syntax/SVNAnnotate.vim (original)
+++ trunk/packages/vim-scripts/syntax/SVNAnnotate.vim Tue Apr  8 21:07:01 2008
@@ -24,7 +24,7 @@
 " IN THE SOFTWARE.
 
 if exists("b:current_syntax")
-  finish
+	finish
 endif
 
 syn match svnName /\S\+/ contained
@@ -32,9 +32,9 @@
 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
+	let did_svnannotate_syntax_inits = 1
+	hi link svnName Type
+	hi link svnVer Statement
 endif
 
 let b:current_syntax="svnAnnotate"

Modified: trunk/packages/vim-scripts/syntax/vcscommit.vim
URL: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim-scripts/syntax/vcscommit.vim?rev=1244&op=diff
==============================================================================
--- trunk/packages/vim-scripts/syntax/vcscommit.vim (original)
+++ trunk/packages/vim-scripts/syntax/vcscommit.vim Tue Apr  8 21:07:01 2008
@@ -23,7 +23,7 @@
 " IN THE SOFTWARE.
 
 if exists("b:current_syntax")
-  finish
+	finish
 endif
 
 syntax region vcsComment start="^VCS: " end="$"




More information about the pkg-vim-maintainers mailing list