Filename Collision nightmare  
Author Message
james_cline_





PostPosted: Team Foundation Server - Version Control, Filename Collision nightmare Top

Here's my situation:

Trunk
|__ Branch A
|__Branch B

Branch A was baseless merged in to B

Branch A was merged into trunk.

Trunk was merged into B resulting in hundreds of filename collisions because the files were created from Branch A via baselss merge and then when merged in via the trunk, TFS doesn't recognize them as the same file and so now my only option when checking in the file is to undo local changes or ignore, neither of which is what I want to happen. I want the changes from the trunk to establish the merge relationship of those files that were baseless merged in from A. However, the only way I can see to do this is to undo the changes on each file force a baseless merge from trunk to B, then resolve the conflict...this however, is far too time consuming to do file hundreds of files....

Any ideas



Visual Studio Team System38  
 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Filename Collision nightmare Top

First, read these so you understand your options:
http://blogs.msdn.com/mrod/archive/2006/08/25/filename-collision-conflict-that-won-t-resolve-through-the-ui-part-1-of-2.aspx
http://blogs.msdn.com/mrod/archive/2006/09/12/751073.aspx

We don't really support indirect merging. You could write a quick script to fix up the merge relationships between trunk <-> B via undo + baseless, but then you'd have the same problem the next time you tried to merge between A <-> B: namespace changes (add/delete/undelete/rename) will lead to namespace conflicts.

The "right" solution depends on what you're trying to do. Do you need to preserve the "triangle" (graph) of relationships Or can you settle into a parent/child (tree) structure between the branches

 
 
james_cline_





PostPosted: Team Foundation Server - Version Control, Filename Collision nightmare Top

THe first link you sent is pretty much the end problem I have and I had found that was the most likely solution. However, I have already merged everything else and this occurred at checkin so I really was hoping to not have too undo everything. The TreeDiff hellps me identify the problem files but it is not easy to bulk undo those files only. If I could somehow generate a list of files with "merge, branch" pending change with both the server and local file being identical and then somehow feed that to an undo command, that would help but how would I easily accomplish this

Also, afte this is done, Branch A is no longer needed for relationship as I would like the relationship to be solely from Trunk to Branch B at this point since we merged A into the trunk and the trunk out to B.

-Jim


 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Filename Collision nightmare Top

The easiest way would be with a PowerShell script or a bit of C#. Something along these lines:

// Determine the server by using the local workspace cache.
WorkspaceInfo wsInfo = Workstation.Current.GetLocalWorkspaceInfo(Environment.CurrentDirectory);
if (wsInfo == null)
{
Console.Error.WriteLine("The current directory is not part of a workspace.");
Environment.Exit(1);
}

TeamFoundationServer tfs = new TeamFoundationServer(wsInfo.ServerUri.AbsoluteUri);
VersionControlServer vc = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Workspace ws = vc.GetWorkspace(wsInfo);
PendingChange[] changes = ws.GetPendingChanges();
List<PendingChange> changesToUndo = new List<PendingChange>();
foreach(PendingChange change in changes)
{
if ((change.ChangeType & ChangeType.Branch) != 0)
{
changesToUndo.Add(change);
}
}
ws.Undo(changesToUndo.ToArray());

warning: untested sample code

 
 
james_cline_





PostPosted: Team Foundation Server - Version Control, Filename Collision nightmare Top

Awesome!

Thanks!