views:

117

answers:

1

Currently when I right-click -> Merge on a specific file in Visual Studio 2008 it attempts (and often succeeds) to automatically merge the file to my indicated target.

How can I force VS to always allow me to manually compare and merge the file in my merge tool?

I should mention that my source control is TFS.

A: 

There are really two potential issues here:

  1. As part of the Merge calculation, the server determines that no changes have been committed against the target file since the last time the two were fully in sync. Therefore, it's safe (by TFS semantics anyway) to simply overwrite the target file.

  2. There are history records in both branches, so the server declares the file to be in a conflict state. It's now up to the client to choose a resolution.

    • You can decide to keep either the source or the target as-is.
    • You can opt for a manual merge in your configured tool.
    • You can request an AutoMerge (via tf resolve -auto:acceptmerge, or the Auto Merge All button on the outer dialog, or the "merge changes for me" radio button on the inner dialog)
      • If the AutoMerge fails, you'll be presented with the same choices except that AutoMerge will be greyed out

There is nothing you can do about situation #1. It really should be safe unless there is a serious unpatched defect in the server code, corruption in the history database, or [most likely] your previous resolution choices have dramatically misled TFS about your true intentions. Worst case scenario, you always have the chance to build & run tests against your pending merge before anything gets checked in.

As you can see, there are many wrinkles to situation #2. It's unclear which step of that process you want to interdict, if any. Good news is, once control is transferred to the client, you have a broad (and easily extended) range of choices. Only tricky part is making sure you understand the consequences of each; admittedly, neither the UI nor the documentation is completely clear on this count. Reply with more details of your issue as needed.

Richard Berg
Thanks Richard. Are you sure situation #1 only occurs if both source and target are identical? I believe it also happens if they are different and VS decides it can safely perform the auto-merge. This is what I'm worried about. The files are sensitive configuration files that I can't afford to mess up. That's why automated tests will not give me the safety I need.So the bottom line is that I can't really manually force the comparison as I right-click -> Merge ?
urig
Actually it should *never* happen when source and target are identical. It happens when the source already has credit for every change made in the target. Example sequence: edit A, edit B, merge B->A [conflict thrown], resolve as accepttheirs ("copy from source"), edit A, edit A again, merge A->B. The server will not issue a conflict because the previous merge brought them fully in sync and B hasn't changed since then. There is no AutoMerge happening at all. B is simply overwritten with the contents from A. AutoMerge only happens in scenario #2, and then only when the user requests it.
Richard Berg