Geeks With Blogs
Mike Azocar So long and thanks for all the Fish!

A while ago I posted that merges by label in TFS Source control do not take into account deleted files. While at Tech Ed at few weeks ago I had a chance to "share my feelings" about this issue with members of the product team. Feeling relieved and somewhat embarrassed, I set out to find a workable solution for this dilemma. After some thought and playing I put my solution out to the VSTS Champs list to verify what I was going to suggest.

á

Here is the method that I used to make sure that files deleted from one branch are kept in sync with another branch:

á

  • Determine which label you want to merge into your target branch and note the date and time. You can search for a label by selecting File > Source Control > Label > Find Labelà from the main menu. We will use the label in Figure 1 for our example.

    á

    Note: You will need to either map the label back to your team build (if you are using an integration build to verify your code before merging) or remember the date and time of your label.

á

Figure 1.

á

  • Merge at the highest folder level from the source (ex. Main) branch to the target (ex. QA) branch. For my example I am merging WindowsApplication2 with WindowsApplication2-Main as shown in Figure 2. You may need to resolve conflicts, but as you won't be checking in the changes, it does not matter.

Figure 2.

á

  • Once the merge is complete, open the Pending Changes window. In the Pending changes window (Figure 3.), search for changesets that contain deletions that are up to and including the date and time of the label. For our example I know that DeleteMe.txt was deleted before the label from Figure 1 and that Class1.cs was deleted after the label was applied. You can use the history of the folder (right click on the folder in the Source Control Explorer and select History) to trace back the deletion date and time of the files (Figure 4).

á

Figure 3.

á

Figure 4.

á

  • Next, check in the deletions and undo all of the other change and merge the two branches by the label you created.
  • Finally, merge the folders again by label.

á

Happy Coding!

Posted on Wednesday, June 27, 2007 4:06 PM | Back to top


Comments on this post: Merging by Label in Team System

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mike Azocar | Powered by: GeeksWithBlogs.net