How to set up SourceGear DiffMerge as the diff/merge tool for Visual Studio?
Asked Answered
F

4

11

I am using TFS for source control, but I want to use SourceGear DiffMerge for viewing file differences and doing merges. I found the Tools -> Options -> Source Control -> Visual Studio Team Foundation Server -> Configure User Tools dialog, but setting up the merge parameters is very confusing. What should those parameters be?

enter image description here

Founder answered 8/7, 2013 at 10:6 Comment(1)
possible duplicate of How do I configure TFS to work with various merge toolsHellraiser
F
3

Firstly, you need to change the default command line to:

C:\Program Files (x86)\SourceGear\Vault Client\sgdm.exe

I found the parameters in this thread on the SourceGear support forums, but the arguments given there are incorrect and result in the auto-merge being executed in reverse, i.e. old code overwrites new code. The correct arguments are:

/m /t1=%6 /t2=%7 /t3=%8 /c=%9 %1 %3 %2 /r=%4

Founder answered 8/7, 2013 at 10:6 Comment(10)
@RubenBartelink: Note my comment there. "The parameters he uses for SourceGear DiffMerge are incorrect. The correct parameters can be found here." Try it out. If you use the parameters listed there, the auto-merge chooses exactly the wrong code as the merge result.Founder
Hmm. I'm using the args from Colin Bacon's asnwer and they seem to work, but I was under the illusion that I was using the ones from the 'universal' blog post for 6 years with no such ill effects - perhaps that's because arg order/semantics changed across sgdm versions (doesnt seem too likely though). Will analyze and report back at some point...Ponceau
Hmm, still using the other config happily - have not taken the time to understand your point as things still seem to work in a nice predicatable fashion that way...Ponceau
@RubenBartelink do the experiment of simulating two non-conflicting changes to one file by two different users, and perform an automatic merge. Try with both sets of parameters and see how differently the merge gets resolved.Founder
OK, I'll keep it on my TODO list - it's just tight at the top of it :(Ponceau
I'm using this now and it's Doing What I Mean. Thanks for pushing!Ponceau
@RubenBartelink "Doing What I Mean" = ?Founder
=> It reads my mind and Just Works for the situations I use it in without me actually being able to necessarily explain in depth what it is that I Mean. (Reference to an ex-colleague's frequent assertion that the really 'all' the User is asking for is a simple Do What I Mean button)Ponceau
@RubenBartelink So, to be clear, does it work with the parameters as I said, or the other way?Founder
ah, sorry - I upvoted and 'this' refers to your parameters as abovePonceau
I
10

These are the SourceGear settings that I use:

C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe

Compare:

/t1=%6 /t2=%7 %1 %2

Merge:

/m /r=%4 /t1=%7 /t2=%8 /t3=%6 /c=%9 %2 %3 %1
Inheritrix answered 29/8, 2013 at 1:46 Comment(1)
I +1'd this but regret it as I @Colin Bacon's order is more intuitive and fits the standard pattern established in https://mcmap.net/q/518154/-how-do-i-configure-tfs-to-work-with-various-merge-toolsPonceau
T
5

These are my settings. Can't remember where I got them from but I have used them in VS2010, VS2012, VS2013.

C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe

Compare

/title1=%6 /title2=%7 %1 %2

Merge

/title1=%6 /title2=%8 /title3=%7 /result=%4 %1 %3 %2

Therefrom answered 29/1, 2014 at 12:15 Comment(1)
My guess is you may have got them from this MSDN blogTranshumance
F
3

Firstly, you need to change the default command line to:

C:\Program Files (x86)\SourceGear\Vault Client\sgdm.exe

I found the parameters in this thread on the SourceGear support forums, but the arguments given there are incorrect and result in the auto-merge being executed in reverse, i.e. old code overwrites new code. The correct arguments are:

/m /t1=%6 /t2=%7 /t3=%8 /c=%9 %1 %3 %2 /r=%4

Founder answered 8/7, 2013 at 10:6 Comment(10)
@RubenBartelink: Note my comment there. "The parameters he uses for SourceGear DiffMerge are incorrect. The correct parameters can be found here." Try it out. If you use the parameters listed there, the auto-merge chooses exactly the wrong code as the merge result.Founder
Hmm. I'm using the args from Colin Bacon's asnwer and they seem to work, but I was under the illusion that I was using the ones from the 'universal' blog post for 6 years with no such ill effects - perhaps that's because arg order/semantics changed across sgdm versions (doesnt seem too likely though). Will analyze and report back at some point...Ponceau
Hmm, still using the other config happily - have not taken the time to understand your point as things still seem to work in a nice predicatable fashion that way...Ponceau
@RubenBartelink do the experiment of simulating two non-conflicting changes to one file by two different users, and perform an automatic merge. Try with both sets of parameters and see how differently the merge gets resolved.Founder
OK, I'll keep it on my TODO list - it's just tight at the top of it :(Ponceau
I'm using this now and it's Doing What I Mean. Thanks for pushing!Ponceau
@RubenBartelink "Doing What I Mean" = ?Founder
=> It reads my mind and Just Works for the situations I use it in without me actually being able to necessarily explain in depth what it is that I Mean. (Reference to an ex-colleague's frequent assertion that the really 'all' the User is asking for is a simple Do What I Mean button)Ponceau
@RubenBartelink So, to be clear, does it work with the parameters as I said, or the other way?Founder
ah, sorry - I upvoted and 'this' refers to your parameters as abovePonceau
G
2

For some reason my old settings for DiffMerge with %1 %2 stopped working, error "File not found (%1). File not found (%2)."

Changed it to:

"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" $(Base) $(Mine)

Giliane answered 16/2, 2015 at 21:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.