2

I just ran into a conflict while working in SVN, and I find myself missing a bit of functionality from Mercurial. In Mercurial, I have vim -d set up as my diff tool. I'm wondering if there is a way to get SVN to work in a similar way? Something along the lines of:

$ svn resolve whatever.py 

Which would bring up vim (in diff mode), allow me to fix the file, and then do an svn resolved to clean up. I work exclusively in CLI (mostly over SSH), so graphical diff tools need not apply.

Does such a thing exist?

Update:
It is probably worth including where in the process I am. I've edited a file (whatever.py), saved it, and done an svn update where someone else has also changed the file. So my svn stat looks like so:

?      whatever.py.mine
?      whatever.py.r7822
?      whatever.py.r7908
C      whatever.py
Jack M.
  • 30,350
  • 7
  • 55
  • 67
  • Have you looked at svndiff? PS Just googled and found this for vim: http://zevv.nl/play/code/vimscripts/ – pmod Jun 28 '10 at 20:20
  • That appears to be comparing `HEAD` to current. Not fixing up a conflict. I'll probably download it, but it doesn't solve this issue. – Jack M. Jun 28 '10 at 20:38
  • 1
    http://stackoverflow.com/questions/19678860/svn-using-vim-to-merge-conflicts/19678861#19678861 – m.divya.mohan Oct 30 '13 at 09:52

4 Answers4

4

set vim as diff tool for Tortoise, for win32 (work for me):

1) Tortoise SVN->Settings->external Programms->diff tool

set External C:\programs\gVim\vim73\gvim.exe -d

set External C:\programs\gVim\vim73\gvim.exe -d

2) unified diff Viewer

C:\programs\gVim\vim73\gvim.exe

3)Merge Tool

"C:\programs\gVim\vim73\gvim.exe" -f -d -c "wincmd J" -c "resize 22" %merged %theirs %mine %base

Sergey
  • 49
  • 1
  • I've gone with this for the merge: `"C:\Program Files (x86)\Vim\vim73\gvim.exe" -d --cmd "set lines=999 columns=999" -c "wincmd J" %merged %theirs %base %mine` – Matthew Strawbridge Dec 12 '12 at 00:04
3

Whenever I have a conflict from a svn update, I'm asked for a half dozen options, one of which is to edit the file in question. Perhaps you need a newer version of Subversion. I'm running 1.6.9.

Andy Lester
  • 91,102
  • 13
  • 100
  • 152
  • This is a pretty old version of subversion, but the question still applies if I decide to postpone resolving this issue. – Jack M. Jun 28 '10 at 20:37
  • So... You're right. The only thing that is missing is the command to actually do the merge. It's `svn merge`. Once I got the updated version, it worked. Toss that in there so I can mark it right. =-] – Jack M. Jun 28 '10 at 21:16
1

In more recent versions of the subversion CLI client, you can set an environment variable SVN_MERGE=vim -d and then select l to launch external tool when a conflict menu comes up during an svn update.

I'm not 100% sure if the parameter order passed by svn matches the one required by vim -d so you might have to write a wrapper script instead of directly calling vim.

The svn manual has full details, of course.

Amardeep AC9MF
  • 18,464
  • 5
  • 40
  • 50
1

Try setting the environment variables EDITOR or VISUAL to vim

the_mandrill
  • 29,792
  • 6
  • 64
  • 93
  • That works for commits and the like, but it doesn't change the diff. I'm already using vim as my `EDITOR`. – Jack M. Jun 29 '10 at 04:29