I'm taking code from a 3rd party, and modifying it. The 3rd party puts out occasional releases, as a zip file, I want to keep my branch, stored in Team Foundation System, up to date with theirs. But I don't see any point of keeping their main trunk in my source control, just so I can merge it into my branch. Is there any way I can just do some kind of baseless merge from their files I download into my TFS branch?
I tried this:
tf merge /baseless "C:\localpath\to\third-party-release-2.0" "C:\localpath\to\mybranch"
and this:
tf merge /baseless "C:\localpath\to\third-party-release-2.0" "$/serverpath/to/mybranch"
and both tell me
No appropriate mapping exists for
C:\localpath\to\third-party-release-2.0.
The merge command applies changes from one branch into another.
According to your command, you are trying to merge something from local to your server branch. This is not supported in TFS. You may need to check in your C:\localpath\to\third-party-release-2.0 into TFS source control first. More info about tf merge command from MSDN.
Related
Background
If I merge our main branch to our development branch, TFS will state that there are no changes to commit. And yet, a file level comparison (using WinMerge) clearly shows that there are differences (e.g. files missing, files with different content, etc.).
In short, our main and development branches are no longer in sync which is most likely due to changesets that were lost during previous TFS migrations.
Question
What is the best way to produce the following?
Synchronizing the main and development branches by: performing all of the necessary insert/update/delete operations on the development branch. (i.e. main is the master copy).
At the end of the process WinMerge should indicate that there are zero (0) differences between the two branches.
Keeping the development branch history intact.
Notifying TFS that the development branch is now fully synchronized with main so that:
TFS won't try to merge older development changesets with main
only future changes to development will be pushed to main during a merge operation.
TFS is not my area of expertise - any guidance that you can provide would be greatly appreciated.
Context
Visual Studio 2015
TFS (version 14.95.25122)
References
Merge Command
"Performs a merge without a base version. That is, allows the user to merge files and folders that do not have a merge relationship. After a baseless merge, a merge relationship exists, and future merges do not have to be baseless."
Although Development was branched from Main, it looks like this might address my lack of history (i.e. missing changesets) problem.
TFS Merge: Best Practices
TFS: Overwrite a branch with another
tf merge A B -r -force -version:T
I don't think this will work for us because changesets are missing.
When TFS does a merge, it bases the merge on prior merge history, not on the actual contents of the source and target files.
This issue may by caused by picking keep target when perform merge or at one time, a merge with the discard option performed (using the command line TF merge /discard).
To solve this issue, you can try to:
Use the /force option with the tf merge command. If there is a changeset that was previously merged (perhaps incorrectly) and you want to merge it again. The /force flag ignores merge history that indicates a particular changeset was previously merged from source to target, and merges the changeset again.
Undo the previous merge using Rollback. If you've recently done the merge in which changesets have been discarded. Find it in the history, rightclick the changeset and pick Rollback and check in the code that has been undone.
I have recently discovered that I was using my third party diff/merge tool incorrectly when resolving conflicts encountered merging from the trunk to my team branch. As far as I know, only files that were merged in the merge tool were affected. I know how to use tf merge /force to re-do a merge, but I don't want to re-merge every file if I can avoid it, just the ones that I had to merge manually. Is there any way to get a list of such files now, long after the merge changesets have been checked in?
Unfortunately, TFS does not track any data about which files were resolved using a merge tool. Whether a file was merged manually or automatically it is still just recorded as a "merge" in TFS.
Here is my current setup. (TFS2008)
I have a TRUNK with latest.
I have BRANCH-A off of TRUNK with only the production ready code merged in.
I would like to create a new BRANCH-B off of TRUNK but I don't want all the latest code, I only want what is currently in BRANCH-A.
After this is done I will be merging into both BRANCH-A and BRANCH-B from the TRUNK (so I don't want to branch BRANCH-B off of BRANCH-A.)
Thanks.
You need to perform a baseless merge. This sibling situation that you want to achieve is exactly what is described in How To: Perform a Baseless Merge in Visual Studio Team Foundation Server:
The process of merging items that are not directly branched from each
other is called a baseless merge. For example, you might want to merge
a change between two release branches, which are siblings of each
other, without merging up to the parent branch. You can only perform a
baseless merge by using the Tf merge command. You cannot perform a
baseless merge from within the Visual Studio IDE.
When you perform a baseless merge, TFS does not have any information
about the relationship of the files in the branches. For example, if
you have renamed a file, this will be viewed as a deleted file and a
new file will be added in the branch. For this reason you have to
perform more manual conflict resolutions than when you perform a
normal merge. However, you only have to perform this conflict
resolution once. After you have performed the baseless merge, TFS
records merge history and establishes a relationship between the
folders and files.
When you create BRANCH-B, you can either choose latest or a specific date/changeset/label. Take a look when you created BRANCH-A and create the BRANCH-B from the same date/changeset/label. As long as you haven't made any changes to BRANCH-A, you can create B to match.
Also, if you haven't already, take a look at the TFS 2008 Branching guidance. There is some great information and uses a pragmatic approach.
For TRUNK
On Create Branch you have option as a "Branch from Version" - by default By Latest Version is selected.
Select By changeSet or By Date
I am merging two branches which do not have a parent child relationship. I have started with a single file to test if the merge is working properly before the actual merge. I am using tfs baseless merge in order to do this.The following is the command:
Tf merge /baseless C:\Inetpub\wwwroot\Test\CreateDescription.aspx.cs C:\Inetpub\wwwroot\Test1\CreateDescription.aspx.cs /recursive
Changes have been done in both the files. However in the resolve conflict dialog box I only see two options
1) Keep the changes in the target branch
2) copy code from source branch
Merge changes in merge tool is greyed out. What should I do in order to enable this option. I want to manually merge changes in the both the branches.
A simple way to do this would be to check out the file you want to be the target (i.e C:\Inetpub\wwwroot\Test1\CreateDescription.aspx.cs) and then use an external merge tool to merge the changes. I'm a big fan our SourceGear Diffmerge, mainly because it's free (as in beer). This will allow you to merge the files and resolve the conflics.
Once you've done this, you could run the baseless merge to establish the merge relationship between the branches and tell the merge tool in TFS to keep the changes in the target. You can also tell TFS to use DiffMerge as it's merge tool which might get rid of the problem all together.
TFS 2010 introduced the ability to convert basic folders into branches. The documentation also speaks of "reparenting a branch" (which does not appear in source control explorer context menu but is accessible only through File>Source Control> Branching & Merging ... hard to find ...)
Let's say I have folders A and A2 under source control.
A2 was COPIED from A some time ago, but is not a branch of A. It is just copied, added to source control and checked-in. Since they are not declared as branches, there is no history of merge operations between A and A2.
The commands "Convert to branch" and "Reparent branch" make me think that both A and A2 can be converted from basic folders to branches and A can be configured as the parent branch of A2, thus giving me the ability to use all the juicy branch features of TFS 2010.
I couldn't get this done. I converted both A and A2 to branches but there are no relations between them. While trying to "reparent" A2, I can not selected A as a parent branch.
How can I do this? If what I am trying to do is not possible, then what is "Convert to branch" and "Reparent Branch" good for?
Reading from different sources you should be able to use Convert to Branch and Reparent Branch after doing a baseless merge between the folders.
Do a baseless merge, but do not actually change any files:
tf merge /baseless /recursive /discard <source> <destination>
Update for VS2012 users:
Visual Studio 2012 does Baseless Merges, which can save time (no TF command line needed)!
I came across this when wanting to branch Master to a specific existing BugFixes folder, which I had converted into a branch.
Simply merge the two unrelated branches, Check In and then reparent.
Works like a whiz! This is what the baseless merge in VS2012 looks like. Thank you to Sahas Subramanian .
http://www.incyclesoftware.com/2012/08/baseless-merge-vs-2012-ui/
See http://www.incyclesoftware.com/2012/08/baseless-merge-vs-2012-ui/ for a walk through (
thanks for the image).
I've never done this before, but here is the link in msdn describing how to do this: http://msdn.microsoft.com/en-us/library/ms181425.aspx