7

I want to use GVim as a merge tool for TFS 2010.
I can't figure out the Arguments for GVim. Specifically the argument %4, when I use it I get an empty buffer for it. if I don't use it I get an error message that I must use it.

enter image description here

kroiz
  • 1,722
  • 1
  • 27
  • 43
  • 1
    Not strictly an answer but have you seen http://www.vim.org/scripts/script.php?script_id=3808 – Benj Oct 02 '12 at 13:25
  • 1
    @Benj, Yes, seen it. that is for working in vim and using the tfs source control. What I want is that when I am working in VS2010 and I click the button to "Merge Changes In Merge Tool" - GVim will open as that tool. – kroiz Oct 02 '12 at 13:33
  • Yeh, I know, it was just a shameless plug ;-) – Benj Oct 02 '12 at 13:34
  • 6
    [This question](http://stackoverflow.com/questions/1313908/how-do-i-configure-tfs-to-work-with-various-merge-tools), and the [link](http://blogs.msdn.com/b/jmanning/archive/2006/02/20/diff-merge-configuration-in-team-foundation-common-command-and-argument-values.aspx) in the accepted answer may help. – romainl Oct 02 '12 at 13:37
  • Maybe the issue is that vim uses diff while it should use something like diff3 for merge... – kroiz Oct 13 '12 at 21:16
  • also I encountered another gvim diff issue that while comparing a file against server latest version; in gvim I don't see the changes although other diff tools like the VS default comparing tool and also tortoise diff tool does actually shows the changes... I really like vim bug I think that for comparing and merging something else should be used... – kroiz Nov 08 '12 at 15:05

2 Answers2

2

This may not be exactly to your liking, but here's how I use GVim for a merge tool.

I set it up to do a two-way merge: it has the 'source' on the left (where I'm merging from), and the merge file on the right (starts off as what my destination branch has for information).

I set it up like this:

command: C:\Program Files (x86)\Vim\vim73\gvim.exe
argument: -c "vert diffsplit %1 " %4 -c "wincmd l|0read %2  |diff"

What this does is as follows:

  • Reads in the 'source' file on the left, and splits the window (-c "vert diffsplit %1")
  • Opens up on the right side the merge result (%4)
  • Runs a quick script which:
    • Moves over the right window (wincmd l)
    • Reads in my existing changes in the branch (0read %2)
    • Re-runs the diff algorithm (diff)

This lets me "diff" my work against the incoming merge, and saving the right hand side will resolve the merge.

Eddie Parker
  • 4,770
  • 3
  • 35
  • 43
0

Your screenshot suggests you are using Vim 7.3 . According to Vim site: http://vim.wikia.com/wiki/Running_diff

At some point, the MyDiff function provided by the "Vim without Cream" installer has been modified. As of Vim 7.3.138 it is still broken.

However, You can try the following verbose-mode parameters

command : gvim
argument: -V -od %1 %2
Henry Aloni
  • 617
  • 7
  • 24
  • 1
    Thanks but I don't have issues with diff. maybe because I did not use the "Vim without Cream" (sourceforge) but rather the gvim from vim.org. – kroiz Oct 13 '12 at 20:55
  • 1
    then just try arguments : -d %1 %2 %4 – Henry Aloni Oct 14 '12 at 05:13
  • 1
    Still the %4 argument produce an empty window. – kroiz Oct 14 '12 at 21:25
  • 1
    From command line you do "gvimdiff -O branch1.txt base.txt branch2.txt merge.txt", this means that TFS merge tool should name these files in that order: %2 %1 %4 %3 , maybe you can try it in that order? – Henry Aloni Oct 15 '12 at 19:10
  • I tried, still TFS does not provide a file for %4, thus it does not work. – kroiz Oct 16 '12 at 15:30