From 9988ab446cd76224b7f93e90032efec52adb6672 Mon Sep 17 00:00:00 2001 From: Bob Hiestand Date: Thu, 28 Jan 2010 14:21:32 -0600 Subject: [PATCH] Removed explicit filetype setting in extensions. This creates a slight bug in that external diff for SVN and HG will say 'No differences found'. This changes the default file type for CVS log output, which will now be CVSlog instead of rcslog. --- plugin/vcsbzr.vim | 17 +++-------------- plugin/vcscvs.vim | 23 ++++------------------- plugin/vcsgit.vim | 23 ++++------------------- plugin/vcshg.vim | 25 ++++--------------------- plugin/vcssvk.vim | 17 +++-------------- plugin/vcssvn.vim | 24 ++++-------------------- 6 files changed, 22 insertions(+), 107 deletions(-) diff --git a/plugin/vcsbzr.vim b/plugin/vcsbzr.vim index bbbca38..1cc5fda 100644 --- a/plugin/vcsbzr.vim +++ b/plugin/vcsbzr.vim @@ -100,7 +100,7 @@ endfunction " Function: s:bzrFunctions.Annotate(argList) {{{2 function! s:bzrFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'BZRAnnotate' + if &filetype == 'BZRannotate' " Perform annotation of the version indicated by the current line. let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let options = ' -r' . caption @@ -119,7 +119,6 @@ function! s:bzrFunctions.Annotate(argList) let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {}) if resultBuffer > 0 normal 1G2dd - set filetype=BZRAnnotate endif return resultBuffer endfunction @@ -151,13 +150,7 @@ function! s:bzrFunctions.Diff(argList) let revOptions = a:argList endif - let resultBuffer = s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1}) - if resultBuffer > 0 - set filetype=diff - else - echomsg 'No differences found' - endif - return resultBuffer + return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {'allowNonZeroExit': 1}) endfunction " Function: s:bzrFunctions.GetBufferInfo() {{{2 @@ -234,11 +227,7 @@ function! s:bzrFunctions.Review(argList) 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 + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) endfunction " Function: s:bzrFunctions.Status(argList) {{{2 diff --git a/plugin/vcscvs.vim b/plugin/vcscvs.vim index 2e9c102..2766348 100644 --- a/plugin/vcscvs.vim +++ b/plugin/vcscvs.vim @@ -181,7 +181,7 @@ endfunction " Function: s:cvsFunctions.Annotate(argList) {{{2 function! s:cvsFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'CVSAnnotate' + 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.]+') @@ -216,7 +216,6 @@ function! s:cvsFunctions.Annotate(argList) 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 @@ -266,13 +265,7 @@ function! s:cvsFunctions.Diff(argList) 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 + return s:DoCommand(join(['diff'] + diffOptions + revOptions), 'diff', caption, {'allowNonZeroExit': 1}) endfunction " Function: s:cvsFunctions.GetBufferInfo() {{{2 @@ -338,11 +331,7 @@ function! s:cvsFunctions.Log(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 + return s:DoCommand(join(['log'] + options), 'log', caption, {}) endfunction " Function: s:cvsFunctions.Revert(argList) {{{2 @@ -360,11 +349,7 @@ function! s:cvsFunctions.Review(argList) 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 + return s:DoCommand('-q update -p' . versionOption, 'review', versiontag, {}) endfunction " Function: s:cvsFunctions.Status(argList) {{{2 diff --git a/plugin/vcsgit.vim b/plugin/vcsgit.vim index 255e9ab..728c94f 100644 --- a/plugin/vcsgit.vim +++ b/plugin/vcsgit.vim @@ -111,7 +111,7 @@ endfunction " Function: s:gitFunctions.Annotate(argList) {{{2 function! s:gitFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'gitAnnotate' + if &filetype == 'gitannotate' " Perform annotation of the version indicated by the current line. let options = matchstr(getline('.'),'^\x\+') else @@ -126,7 +126,6 @@ function! s:gitFunctions.Annotate(argList) let resultBuffer = s:DoCommand('blame ' . options, 'annotate', options, {}) if resultBuffer > 0 normal 1G - set filetype=gitAnnotate endif return resultBuffer endfunction @@ -165,13 +164,7 @@ function! s:gitFunctions.Diff(argList) endfor endif - let resultBuffer = s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {}) - if resultBuffer > 0 - set filetype=diff - else - echomsg 'No differences found' - endif - return resultBuffer + return s:DoCommand(join(['diff'] + diffOptions + a:argList), 'diff', join(a:argList), {}) endfunction " Function: s:gitFunctions.GetBufferInfo() {{{2 @@ -212,11 +205,7 @@ endfunction " Function: s:gitFunctions.Log() {{{2 function! s:gitFunctions.Log(argList) - let resultBuffer=s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {}) - if resultBuffer > 0 - set filetype=gitlog - endif - return resultBuffer + return s:DoCommand(join(['log'] + a:argList), 'log', join(a:argList, ' '), {}) endfunction " Function: s:gitFunctions.Revert(argList) {{{2 @@ -241,11 +230,7 @@ function! s:gitFunctions.Review(argList) let prefix = substitute(prefix, '\n$', '', '') let blob = '"' . revision . ':' . prefix . '"' - let resultBuffer = s:DoCommand('show ' . blob, 'review', revision, {}) - if resultBuffer > 0 - let &filetype=getbufvar(b:VCSCommandOriginalBuffer, '&filetype') - endif - return resultBuffer + return s:DoCommand('show ' . blob, 'review', revision, {}) endfunction " Function: s:gitFunctions.Status(argList) {{{2 diff --git a/plugin/vcshg.vim b/plugin/vcshg.vim index a053f5e..a520172 100644 --- a/plugin/vcshg.vim +++ b/plugin/vcshg.vim @@ -111,7 +111,7 @@ endfunction " Function: s:hgFunctions.Annotate(argList) {{{2 function! s:hgFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'HGAnnotate' + if &filetype == 'HGannotate' " Perform annotation of the version indicated by the current line. let caption = matchstr(getline('.'),'\v^\s+\zs\d+') let options = ' -r' . caption @@ -127,11 +127,7 @@ function! s:hgFunctions.Annotate(argList) let options = ' ' . caption endif - let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {}) - if resultBuffer > 0 - set filetype=HGAnnotate - endif - return resultBuffer + return s:DoCommand('blame' . options, 'annotate', caption, {}) endfunction " Function: s:hgFunctions.Commit(argList) {{{2 @@ -175,15 +171,7 @@ function! s:hgFunctions.Diff(argList) let diffOptions = ['-x -' . hgDiffOpt] endif - let resultBuffer = s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) - if resultBuffer > 0 - set filetype=diff - else - if hgDiffExt == '' - echomsg 'No differences found' - endif - endif - return resultBuffer + return s:DoCommand(join(['diff'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) endfunction " Function: s:hgFunctions.Info(argList) {{{2 @@ -259,12 +247,7 @@ function! s:hgFunctions.Review(argList) let versionOption = ' -r ' . versiontag . ' ' endif -" let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {}) - let resultBuffer = s:DoCommand('cat' . versionOption, 'review', versiontag, {}) - if resultBuffer > 0 - let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype') - endif - return resultBuffer + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) endfunction " Function: s:hgFunctions.Status(argList) {{{2 diff --git a/plugin/vcssvk.vim b/plugin/vcssvk.vim index c1142d7..15e1c1e 100644 --- a/plugin/vcssvk.vim +++ b/plugin/vcssvk.vim @@ -105,7 +105,7 @@ endfunction " Function: s:svkFunctions.Annotate(argList) {{{2 function! s:svkFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'SVKAnnotate' + 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 @@ -124,7 +124,6 @@ function! s:svkFunctions.Annotate(argList) let resultBuffer = s:DoCommand('blame' . options, 'annotate', caption, {}) if resultBuffer > 0 normal 1G2dd - set filetype=SVKAnnotate endif return resultBuffer endfunction @@ -156,13 +155,7 @@ function! s:svkFunctions.Diff(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 + return s:DoCommand(join(['diff'] + revOptions), 'diff', caption, {}) endfunction " Function: s:svkFunctions.GetBufferInfo() {{{2 @@ -238,11 +231,7 @@ function! s:svkFunctions.Review(argList) 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 + return s:DoCommand('cat' . versionOption, 'review', versiontag, {}) endfunction " Function: s:svkFunctions.Status(argList) {{{2 diff --git a/plugin/vcssvn.vim b/plugin/vcssvn.vim index da738ee..08e46d2 100644 --- a/plugin/vcssvn.vim +++ b/plugin/vcssvn.vim @@ -116,7 +116,7 @@ endfunction " Function: s:svnFunctions.Annotate(argList) {{{2 function! s:svnFunctions.Annotate(argList) if len(a:argList) == 0 - if &filetype == 'SVNAnnotate' + 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 @@ -132,11 +132,7 @@ function! s:svnFunctions.Annotate(argList) let options = ' ' . caption endif - let resultBuffer = s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {}) - if resultBuffer > 0 - set filetype=SVNAnnotate - endif - return resultBuffer + return s:DoCommand('blame --non-interactive' . options, 'annotate', caption, {}) endfunction " Function: s:svnFunctions.Commit(argList) {{{2 @@ -180,15 +176,7 @@ function! s:svnFunctions.Diff(argList) let diffOptions = ['-x -' . svnDiffOpt] endif - let resultBuffer = s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) - if resultBuffer > 0 - set filetype=diff - else - if svnDiffExt == '' - echomsg 'No differences found' - endif - endif - return resultBuffer + return s:DoCommand(join(['diff --non-interactive'] + diffExt + diffOptions + revOptions), 'diff', caption, {}) endfunction " Function: s:svnFunctions.GetBufferInfo() {{{2 @@ -264,11 +252,7 @@ function! s:svnFunctions.Review(argList) let versionOption = ' -r ' . versiontag . ' ' endif - let resultBuffer = s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {}) - if resultBuffer > 0 - let &filetype = getbufvar(b:VCSCommandOriginalBuffer, '&filetype') - endif - return resultBuffer + return s:DoCommand('cat --non-interactive' . versionOption, 'review', versiontag, {}) endfunction " Function: s:svnFunctions.Status(argList) {{{2 -- 2.11.4.GIT