Create VSTS Merge report - tfs

We are using VSTS/TFS for source code control. We sometimes have to Merge branches. When a conflict rises between files we get the Source, the Target, and the proposed new file. What I am looking for is a Merge report which shows this for all files merged, even the files that do not have conflicts.
Does anyone know if this is possible in VSTS?

Depends on your definition of possible... After performing the merge, before resolving any conflicts you can run tf folderdiff to get all changed files and their status. Then use tf diff to get the differences between the source and target.
Or you can use the Visual studio client object model to query all of the information.
There is no built-in Visual Studio wizard or option to just export a report.

Related

How to handle missing 'added' files during check-in

I have a bunch of files in the 'added' state across many folders that were accidentally deleted from the file system. How can I easily either undo them or convert all of them to a 'delete' status? I'd prefer not to have to manually undo each file one at a time.
What I've tried so far:
In the Pending Changes window, using the Undo command for each missing file is tedious. Since the window does not identify which files are missing, I have to compare this window to the file explorer and compare the contents of each folder.
The answers for this similar question don't apply to me because my files are in the 'added' state, so comparing my workspace to the server will not identify these missing files.
I've looked through the TFS Power Tools for something to identify missing files but haven't found anything that directly addresses missing files.
The tfpt online command doesn't address missing files in the 'added' state.
If I read you correctly, in this case your underlying file system and what TFS thinks is on your file system have gotten out of sync.
The best, easiest, way I know how to rectify this is to undo all your changes, then redo the adds, deletes, and edits that you actually require. I know that with many files this will be a pain, but let me reiterate: I mean the best, easiest way and not the fun, effortless way (which I don't think exists)!
Do a 'clean' in your project within Visual Studio, then delete any bin/ and obj/ folders in the source.
Then undo all changes for your project.
If you are using TFS < 2013, I would recommend the use of Team Foundation Power Tools online functionality. For instance:
cd \dev\path\to\project\root\
tfpt online /adds /diff /deletes /recursive .
Otherwise, if you are using TFS 2013, then you can use the built-in 'reconcile' functionality (cannot find a web URL for this, the 2010 docs are incorrect, use 'tf reconcile /?' for a description):
cd \dev\path\to\project\root\
tf reconcile /adds /deletes /diff /recursive /noignore /promote .
With TFS Power Tools installed, run this command from a VS command prompt in the appropriate folder:
tf reconcile /deletes /diff /recursive /noignore /promote
This will display a list of pending changes. The missing files will all be selected with a new status of 'delete'. Click Promote to save the change, then try again to check in.
This is a slight variation of d3r3kk's answer but without the /add flag which causes more files to be selected than necessary.

How to transfer a project from ClearCase to TFS?

Excuse me for the novice question :blush:
How do I detach a project from ClearCase in order to add it to a TFS source control system?
The easiest way is to do whats called a "tip" migration. This just means grab a copy of your source code from ClearCase to your harddrive. Then add all the files to TFS. This will bring over the latest version of your code, but will not bring over the history.
If you want to do a migration that brings over history you will need to use a tool such as the TFS Integration Platform. The ALM Rangers have produced a connector for ClearCase and a bunch of training and videos on how to perform a migration that can be found here: http://blogs.msdn.com/b/willy-peter_schaub/archive/2011/07/27/getting-started-with-ibm-rational-to-team-foundation-server-tfs-migrations.aspx
I know it's silly but here's what I needed to do -
Open each of the csproj files
For each one, remove the xml nodes starting "Scc" (like SccProjectName, SccAuxPath, SccProvider etc) it seems they were the ones bothering the Visual Studio.
Reload the projects and add them to desired TFS workspace
Additional Steps that may need to be done:
Open the .sln with a texteditor and delete the entire section about source control.
In Visual Studio go to Extras -> Options... -> Sourcecontrol and change the plug in to TFS

TFS 2012 Locating a Source Control File

TFS 2012 is installed on a Server. On this server there are 3 projects- Dev, QA, and Prod. Is there a way to locate where a source code file is on the server. So be able to tell if it is in the Dev, QA, or Prod project currently. And would this be by Source Code name or by using a label and searching for that label?
I would say that division you have made as projects isn't the intended way of using TFS, they're meant to be made as branches within the same project. You may have specific reasons to have them created as projects (and I'm interested in why), but you won't get much help from standard TFS source there, I'm afraid.
You can use Find in Source Control on wildcards or the equivalent tf command
tf info [wildcard] /recursive
to look for source control paths, but there are two caveats:
this search is limited to per-project, so you will have to do the search for each of your projects in turn (until you get a hit).
By default the command returns all source-controlled objects, even deleted ones, so you'll have to filter the search on DeletionID and Local path
This command could be scripted to search through each project folder. And here's a related Q&A for doing it programmatically.

Team Foundation Server - TF Get with changeset number

I'm trying to write a very lightweight "build" script which will basically just get a few files from TF (based on a Changeset number). Then I'll run those files in SQLCMD.
I'm using this:
tf.exe get c:\tfs\ /version:c2681 /force /recursive
However, this appears to get EVERYTHING, not just the files in changeset #2681. I'd like to be able to point it to the root of my tfs workspace, give it a changeset number, and have it just update those few specific files. Also, it appears to be getting older versions (perhaps what was current when changeset #2681 was checked in)?
Is there a way to get just those specific files, WITHOUT needing to call them out specifically in the tf get itemspec?
EDIT: I actually had to add the /force option in order for it to do anything at all. Without force, it doesn't appear to even retrieve from the server a file I deleted locally, that's definitely in the changeset.
thanks,
Sylvia
Everything mentioned in Jason's and Richard's posts above is correct but I would like to add one thing that may help you. The TFS team ships a set of useful tools separate from VS known as the "Team Foundation Power Tools". One of the Power Tools is an additional command line utility known as tfpt.exe. tfpt.exe contains a "getcs" command which is equivalent to "get changeset" which seems to be exactly what you are looking for.
If you have VS 2010, then you can download the tools here. If you have an older version, a bing :) search should help you find the correct version of the tools. If you want to read more about the getcs command, check out Buck Hodges's post here.
The TFS server keeps track of what each workspace contains1. Any changes made locally with non-TFS client commands (whether tf.exe, Team Explorer or another client) will lead to differences between the TFS Server's view and what actually exist.
The force options on the various clients just gets everything removing such inconsistencies (effectively resetting both what is on the client and what the server thinks is there).
When you perform a get against a specified version (whether date, changeset or label) you get everything up to and including that point in time, whether on not specifically changed at that point. So getting
tf get /version:D2012-03-30
will get changes made on or before that date.
To get only the items included in a changeset you'll have to do some work yourself, using a command to get a listing of the content of a changeset and parse that to perform the right actions (a changeset can include more than just updates and adds of files2).
It seems to me that if you want to perform a build at each changeset affecting a particular TFS folder you would be better off looking at using TFS Build which is all about doing exactly that – avoid reinventing the wheel – and focus on the build part (other continuous build solutions are available).
1 This will change with TFS11 local workspaces.
2 Eg. handing the rename of a folder will take some non-trivial work.
The command will get all the sources for the given changeset. By default it will only get the files that it thinks are different between your workspace and the server. However, by using the /force option you are asking it to get everything regardless of the state it thinks your workspace is in (which is much slower but has the benefit of ensuring your workspace is fully in sync with the server).
So just removing /force will probably achieve what you want.
edit
As I said above, tfs will get all files that it thinks are different from the server. If you manually delete a file from your local workspace, TFS won't know that it is missing from your local version, so it won't think it needs to update the file. There are three solutions to this:
Use /force to make sure things are in sync, and put up with it being very slow.
Don't modify files in your workspace with anything other than TFS tools (tf.exe, Visual Studio, TFS power tool for the explorer shell). You shouldn't just delete files on your local hard drive - if they really need to be deleted, then delete them in source control.
Go offline in TFS before you make changes manually. Then when you go online, TFS will search for all the changes you have made and add them to your pending changes so that TFS is aware of them.

Team Foundation - how to get files that are only part of a solution

We use TFS as our source control repository. As a result we have files that are stored in the tree but are NOT part of the main solution.
During the build process I use the following command:
tf get $/mysolutionPath /recursive /all
/noprompt
This returns all files even those that are not part of the solution or its projects. I wonder if there is a way to get only files/projects that are only part of a specific solution, similar to Visual Studio's "Open Solution from source control" option.
No, because this is a feature implemented by the visual studio source control plugin to TFS. It uses the project's file list to request the files it is interested in (which is to say only files that are part of the solution).

Resources