TFS DB query to get merged changesets from one branch to another - tfs

I would like to make a report that will show what changesets were promoted from one branch to another one. I've got all needed information about changesets in my query, but i cannot find a reference between changeset from the MAIN branch and changeset used to merge it to another branch.
Is there a way to get this by querying TfS_Warhouse?
Thank you.

It's not recommend to query information from TFS database directly.
You could use TFS API to achieve what you want. And also it's much easy to query the information. Here is a good example TFS API - Get merged changesets for you reference.

Related

determine which branch a changeset is associated with tfs_warehouse

I'm querying the TFS_Warehouse and TFS_DefaultCollection databases to look at changesets but I need to determine which branch the changeset is associated with. This isn't obvious to me looking at the data. Ideas?
You can write queries against the TFS data warehouse or the TFS analysis cube. However, do not write queries directly against the project collection databases, it's not suggested and will lose support.
A changeset can of course contain files in multiple branches. There is not any table or query could indicate which branch a changeset is associated with.
The simplest way is through tracking changeset feature.
Detail steps please refer this question: Is there a way to find out the source changeset from which a particular branch was created in TFS?
If you insist on using SQL, you could first get all files and version numbers with a particular changeset, and then through all of the files get the related branch. Take a look at below thread which may be helpful:
TFS Listing of all files and version numbers with a particular changeset
TFS: Find Files Affected Between Changesets

Is there a way to ask tfs what changesets were merge to form a changeset?

I'd like to see what changesets were merged to create a changeset on a branch in the history. This doesn't seem to be straight forward. I've tried to use the Track Changeset functionality, but I can't seem to see anything useful. I would also like it if I could do this from the command line so that I could potentially script a way to pull out appropriate changesets separately.
Edit
Ok, seems that using Timeline Tracking, I can get the changesets from the Track Changes feature. Now is there a way to do this from the command line?
Using Tracking Changeset window is the right way to View where and when changesets have been merged.
For the overview and some meaning of the elements in tracking changeset window, you could refer above link. And switch to timeline view will make the result more directly,clearly.
Afraid you could not do this through command line. There is a Merges Command, but could not specific a single changeset.
However, you could use TFS API to achieve this, take a look at below two similar questions:
Find changeset id parent of a branch in tfs
Is there a way to find out the source changeset from which a particular branch was created in TFS?
The answer contains a link to a blog post which contains many details, including TFS API and a custom command-line tool.

How can I filter TFS changeset history to exclude a certain user?

Is it possible to filter changesets in TFS 2012 to exclude the ones from a single user?
The commit history of the solution I currently work on contains quite a lot of noise due to an automated process making a commit each time a build is queued.
I'd like to filter it out to make the commit history more readable.
An alternative, try to install Team Foundation Sidekicks, and check History Sidekick. You can export the records to a .csv file and then filter the user in it:
There is no single query can achieve what you need. You may have to use TFS API.
If you want to get the changesets in a solution via TFS API. The folder history will be the simplest approach. Details please refer this: TFS client C# API - get all changesets of an Item You can exclude those changesets from the special user using Changeset.Committer Property which gets the user who committed the changeset.

Any way to obtain what TFS element someone worked on?

I just received instructions to add the TFS element number to the comment of any changeset I commit. I find this mesure redundant because I already have to assign the TFS element to my changeset.
I was told it was because it was hard to obtain the list of TFS element a developper worked on.
Isn't there a smarter way to obtain this information?
With using Work Item links between a Changeset and Work Items (the recommended approach - assuming your are using TFVC), you could write a bit of code against the TFS API, or a query against the TFS Data Warehouse to retrieve all changesets by Developer A, then traverse the WI links to find all WI's.

Get the info if a changeset was merged from one branch to another

in TFS2010, would it be possible to obtain** information if a changeset was merged from one branch to another?
The "query" would take source and target branches as parameters and then return yes / no information for each changeset if it was merged.
** Obtain - via ordinary query? Or maybe in more sophisticated way. I'm a collection administrator, do not have access to TFS database, but if I had, would it be hard to code that query?
Thx in advance.
The TF Merges Command should help, use the changeset as the versionspec

Resources