1

CVS diff has the option to display revisions side by side and denote diffs with usual patch symbols like:

import zlib                                        import zlib
                                                 > import time
import traceback                                   import traceback

import cElementTree as ElementTree                 import cElementTree as ElementTree

from util import infopage                          from util import infopage
                                                 > from util.timeout import Timeout

Is there anyway to pipe that output to vimdiff so that it displays those two columns in two side-by-side buffers along with all the diff-highlighting goodness of vimdiff?

I'm aware of tools like cvsvimdiff.vim and the like, but the problem with those is that they only work on one file at a time, whereas the cvs diff output lists multiple files.

innaM
  • 47,505
  • 4
  • 67
  • 87
Samer Atiani
  • 695
  • 1
  • 6
  • 8

2 Answers2

1

Once you have that text in a Vim buffer, you can easily split it into two buffers yourself. Looks like your sample input does the split at 50 characters.

So use <C-v> to visual-block highlight half of the diff, cut it, paste it in a new buffer, remove trailing whitespace and the > separator characters, and there you go. Or write a function to do it, something like this (which assumes the split is always at 50):

function! SplitCVSDiff()
    exe "norm gg_\<C-v>51\<Bar>Gd:vnew\<CR>p"
    silent! %s/\v\s+(\> )?$//
endfunction

Might have to be made more robust, I'm not familiar with the exact style of output CVS uses. Shouldn't be hard though.

Brian Carper
  • 71,150
  • 28
  • 166
  • 168
0

I would write a script say : vimdiff_cvs file.cc which does this:

  1. Store diff of file.cc locally, delete it, update to repository. Now copy it as ~/.vimdiff/file.cc.repo.
  2. Restorefile.cc by applying the patch
  3. Call vimdiff file.cc ~/.vimdiff/file.cc.repo.
sud03r
  • 19,109
  • 16
  • 77
  • 96