This project has moved. For the latest updates, please go here.

Merging from DEV To Main doesn't show Main as a valid Target Branch

Jan 20, 2010 at 10:20 PM

Thank you and the rest of the VSTS Rangers for putting out the latest VSTS 2010 Branching Guidance and Virtualization Guidance.

I wanted to pose a question on branching and the VSTS 2010 Tools.

I posted this question on the forums. Hopefully you can read this and answer

1) why the VSTS 2010 branch & merge tools not support merging from DEV To Main and doesn't show Main as a valid Target Branch in the merge wizard.  (Forum post below has more details)

2) Why a new subfolder in a Dev Branch not become a child of the Main branch when merged to Main.

http://social.msdn.microsoft.com/Forums/en-US/tfsversioncontrol/thread/c8fe8ac4-d685-4ca0-bb9e-382f31a006f7

Thank you for your time,

Regards,

Michael Dang

Seismic Micro-Technology, Inc.

Configuration Management Lead

Developer
Jan 21, 2010 at 12:02 AM

Michael.

To answer question 1 -

  • In VS 2010, there is a new icon for a branch that is different from the icon for a folder. Can you confirm that Main and Dev are both branches?
  • What is the merge relationship between Main and Dev (View the branch hierarchy). Main should be a parent of Dev. If this is not the case it would explain why you cannot merge from Dev to Main. Only branches with a direct parent/child relationship can be merged in the UI.

To answer question 2 -

  • When you created a new sub folder in the Dev Branch, make sure you check-in this change before doing the merge from Dev to Main.
  • After a successful merge, this new sub folder should also appear under the Main branch.

I hope this helps. Feel free to ask more questions.

Regards,
Bill Heys
VS Ranger

 

Developer
Jan 21, 2010 at 12:05 AM

Michael,

Make sure your workspace mappings include the complete source tree for the team project.

Regards,

Bill Heys

Developer
Jan 21, 2010 at 12:47 AM

Michael,

One final thought. In VSTS 2008, it was difficult in Source Control Explorer to distinguish between folders, subfolders, container folder, and branches. The icon for everything looked like a folder.  It therefore is challenging sometimes in VSTS 2008 to figure out which of these is a parent branch or a child branch. It should be easier in VS 2010 to see this distinction in VS 2010, since Branches are now a first-class object and are visually distinguished from folders.

In VS 2008, if you branched $\TeamProject\Main\Src to $\TeamProject\Dev, Main would not be the parent branch of Dev. Rather Main\Src would be the parent to Dev. You should branch $\TeamProject\Main to $\TeamProject\Dev OR branch $\TeamProject\Main\Src to $\TeamProject\Dev\Src to keep things consistent.

Regards,
Bill Heys
VS Ranger

Jan 21, 2010 at 3:52 PM

Hi Bill,

Thanks for replying.  To answer your questions:

Yes, in VSTS 2010 I can confirm that both Main and Dev are branches and the branch hierarchy diagram indicates Dev is a child of Main.  The icons of the Main & Dev folders are the new branch icons introduced in VSTS 2010.

Yes, I did check-in the new subfolder into Dev then I merged to Main by label.  However, the merged subfolder is now a child of Dev.  This is the Properties for the new subfolder when viewing the Branches tab.

    $/TeamProject/Dev/Subfolder                        add

            $/TeamProject/Main/Subfolder              merge,branch  480

 

I have the entire team project workspace mapped to a folder.  SCC Folder: $/TeamProject    Local Folder: D:\Workspace\SourceCode\MyCollection\TeamProject

In regards to your third post.  Yes, I did branch from $/TeamProject/Main to $/TeamProject/Dev. 

Why is the VSTS 2008/2010 tool acting in this behaviour?  Common in a DEV branch development, there are new folders that eventually would be merged to the Parent Main branch when ready.  My expected result would be that the new merged folder to Main becomes the parent.  

Could you replicate this scenario?  Maybe its just me. 

Mike

 

 

Developer
Jan 21, 2010 at 4:04 PM

Mike,

I will attempt to reproduce this. In the meantime, if you could try to give me the steps I should follow to repro it and any error messages you get, it would help.

Thanks,
Bill Heys
VS Ranger

Jan 21, 2010 at 7:59 PM

Bill,

Hope these repro steps are good enough.  There are no real error messages.

 

1. Set workspace mapping of root team project.   Source Control Folder: $/TeamProject           Local Folder: D:\Workspace\TeamProject

2. Create new folder and Check-in SCC folder $/TeamProject/Main

3. Select folder $/TeamProject/Main and Branch from Version by "Latest Version".  Target Branch Name: $/TeamProject/Dev

4. Check-in new $/TeamProject/Dev branch into SCC

5. View the branch hierarchy to ensure Main is the parent of Dev

6. Create new folder and Check-in SCC folder $/TeamProject/Dev/NewFolder

7. Add and check-in a new file into $/TeamProject/Dev/NewFolder (Optional Step)

a. The Merge Problem of a new folder in a child branch

      i. Right Click and Merge $/TeamProject/Dev/NewFolder

      In Source Control Wizard the Source branch is $/TeamProject/Dev/NewFolder AND the target branch dropdown is empty. Despite the $/TeamProject/Dev branch is a child of $/TeamProject/Main the target branch dropdown is empty.

      ii. Right Click and Merge $/TeamProject/Dev

      In Source Control Wizard the Source branch is $/TeamProject/Dev AND the target branch dropdown has $/TeamProject/Main

8. To get around merge problem merge by one of two following methods and Check-in:

    a. Label $/TeamProject/Dev/NewFolder including the root ($/TeamProject/Dev) in the label

   OR 

   b. Changeset including the root and undo any other miscellaneous pending changes. Only the $/TeamProject/Main/NewFolder should be in the pending changes list

9. After checkin right click on $/TeamProject/Main/NewFolder and select Properties. Select Branches tab. The $/TeamProject/Main/NewFolder is a child of the DEV branch.

 

Thanks

 

Mike

Developer
Jan 21, 2010 at 8:45 PM

Mike,

I was able to repro this without a problem

Before step 3, I converted Main to a Branch (VS 2010)

On step 7a. The NewFolder is a sub-folder of the branch $/TeamProject/Dev). Dev is the Branch. So on the merge, you should right-click on Dev. to do the merge

This explains why you get now target branches in the dropdown. You do not need to do step 7.a.i. You should only do step 7.a.ii

When you do this merge, the subfolder should merge into Main.

In my view, done properly (merge branches not folders), you should not have to do step 8.

If you do this, you have a very convoluted branch hierarchy - Main is a parent of Dev, but Main/NewFolder is a child of Dev. - I don't think you want this.

Regards,
Bill Heys
VS Ranger

 

Developer
Jan 21, 2010 at 9:00 PM

Mike,

My repro was as follows (VS 2010, but should work as well in 2008)

1. Create new team project (MikesTeamProject)
2. Create workspace mappings $/MikesTeamProject -> c:/MikesTeamProject
3. Make this the active workspace
4. Add a folder MAIN to MikesTeamProject
5. Checkin pending changes
6. Convert folder MAIN to a branch (VS 2010 only)
7. Branch Main -> Dev
8. Get Latest (Dev)
9. Under Dev branch, add new sub-folder NewFolder
10. Checkin Pending Changes (Dev) (note at this point DEV is a branch, and NewFolder is a subfolder under DEV; Main has no subfolders
11. Right-click on DEV and merge to Main
12. Check-in pending changes to Main (at this point NewFolder is also under Main)

The same steps are used for VS 2008 except you may need to do a check-in after doing a branch, and you would not convert folders to branches (since branch as a distinct object is introduced in VS 2010.

Regards,
Bill Heys
VS Ranger

Jan 21, 2010 at 10:02 PM

Bill,

Followed your steps.  Yes, the NewFolder is under Main.

Could you in your repro right click on $/TeamProject/Main/NewFolder and select Properties. Select Branches tab.

Under Branches my result is this.  Is this correct? Is this what is expected?

$/TeamProject/Dev/MyNewfolder                    add

      $/TeamProject/Main/MyNewfolder        merge,branch     547

 

If this is what is expected I have to accept that anything added into Dev and Merged to Main will always be a child of DEV.

Mike

Developer
Jan 22, 2010 at 1:02 AM

In this example, you have two branches DEV and MAIN. NewFolder is a folder under each of these branches.

In VS2010, when you view the properties of a branch you see something very different than when you view the properties of a folder.

When you are on the branch tab of the properties for a folder it is showing you somewhat of a history of that folder. In your case it was added initially to the Dev branch and then was merged into the Main branch on changeset 547.

This tab is not showing you a hierarchical relationship between branches. Therefore this is not showing you any parent/child relationships.

Regards,
Bill Heys
VS Ranger

Jan 22, 2010 at 7:06 PM

Bill,

Thanks for clarifying and helping!  You Rock!

 

mike