index > Team Foundation Server - Version Control > Few questions on merging through the API

Few questions on merging through the API


I'm trying to implement merge from the API and I have few question to the people in the forum.

The main idea of my application is to merge between two folders (with branch relationship) based on changesets.

These are the main steps of my application:

    • Merge operation using - workspace.Merge(params) function.
    • Looking for conflicts by querying the workspace workspace.QueryConflicts(params)
    • For each conflict I'm trying to resolve it by - workspace.ResolveConflict (params)
    • Then, if I can merge the content I'm trying to merge again the content using - workspace.MergeContent(param)

My questions are:

    1. There is a way to command the merge function (workspace.Merge) to force the source version to be in the target folder,
    2. The function gets MergeOptions parameters and there is  MergeOptions.ForceMerge option

      But for some reason the force option is not working as I thought it should be, I probably miss something.

    2.      When I get some conflict from the merge status, there is a way to open the dialog box that I use to resolve conflicts from the IDE.

    3.      I have some very weird thing on my application, when I'm 'running' on my conflicts in a loop  I'm trying to resolve the conflicts that came out (using -workspace.ResolveConflict(conflict[index])), also, I'm using the merge content function - workspace.MergeContent(conflict[index], false);

      Both of this functions returning Boolean parameter, how can it be that the workspace.ResolveConflict returns false and the workspace.MergeContent that run on the same conflict returns true.

    4.      There is a way to merge content of folder accept of isolated files using the API

    5.      It looks like win form bug, but, when I'm getting from the IDE the dialog box for resolving conflicts even if I'm canceling the merge operation I get pending changes on my files.

      **Does any one know where can I find some fine documentation on the merge  

          operation ??how does it works exactly (all the blocks stuff and so on)


      Thanks in advance,

      Shmulik.

shmulik_segal
  1. If you specify ForceMerge then you also need to specify a version range. Doing a Force merge where the end of the version range is Latest should get what you want (basically a straight copy).
  2. No, unfortunately all the dialogs in v1 are private. Some people have tried to use reflection to get around it but this is not supported.
  3. Those two methods do totally different things. ResolveConflict tells the server how to handle a variety of cases: renames, undeletes, version conflicts (i.e. parallel edits), namespace conflicts, writable file conflicts, and more. In your case, since you want to mirror the source to the target, you should just pass AcceptTheirs for each kind of conflict.
    MergeContent does what it sounds like -- attempts a client-side 3-way merge of the file contents. Obviously this can succeed independently of the "tree" conflicts mentioned previously. However, I don't think you want to do this in the first place. If you do a content merge then the target may end up with something different from the source.
  4. No.
  5. Cancelling the resolve doesn't cancel the merge. You can always rightclick -> Resume Conflict Resolution later.
Richard Berg MSFT
reply 2

You can use google to search for other answers

 

More Articles

Can anyone remove the workspace which created by Administrator?
GET does not actually retrieve any files
View file permissions
Associating server folders with comment.
Heeeeeelp!! i cant unlock a file locked by other user!!
Problem when deleting and adding a new project from source contro...
many applications sharing framework projects, and each on a diffe...
Team Foundation Server SCC Api
TF MSSCCI Provider on 64Bit Windows Server
Mapping a local folder to more than one source control folders
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

File Date in TFS-VC
Source control plugin not installed or n…
PIN and UNPIN event migration problem
TFS source control path length limitation.
Nice tool but small annoyances
VSTS and database object version control
How can I get files that are changed fro…
Sharing common components across project…
Working directory configuration
How to get file base on WIT from command…
Foundation server Proxy
The Selected file cannot be opened as a …
Foundation Server MSSCCI Provider Not Wo…
Cannot Get Files
many applications sharing framework proj…

Hot Articles

Source Control - default working Path
Is there a way to...?
Replace TFVC with another source control
Preserve timestamp on files when getting…
Orphaned branch
Check In Policy to ensure that code builds
Latest updates are reflected to the server
Multiple Source control Databases in TFS
Exception when using MSSCCI provider 1.0…
Source Safe Conversion Issues
Approval check-inpolicy
Putting SQL Server DB Objects under Vers…
How can I get files that are changed fro…
Version History
How to rollback bad check-in?

Recommend Articles

Diff between two labels not working
Project files of our solution are automa…
Source Control - default working Path
migration_settings.xml
Team Foundation Version Control Command …
Coexistence of VSS and TFS
Unshelving and merging changes
Migrate from ClearCase to TFS
Approval check-inpolicy
TFS Permissions
Check-in from different directory
File attrib being changed to writeable
Foundation server Proxy
Check In by Changeset After Merge
Merge by WI