user5551344
user5551344

Reputation: 81

TFS SQL - Select a list of unmerged changesets

Using SSMS and connecting to the TFS server I am attempting to select a list of all change sets which have yet to be merged to other branches within the same project, and am at a loss as to which tables to utilize, or how to join them.

The goal is to present information in such a way that it generates a result set as:

UserName | CountOfUnmergedChangeSets

User1 | 32

User2 | 1

User3 | 10

I see that there is "dbo.tbl_ChangeSet" ins the project database, and another titled "[dbo].[DimChangeset]" in the [Tfs_Warehouse] database. I also see the dbo.tbl_MergeHistory, but have not been effective in determining how to use that along with the changeset tables.

Upvotes: 1

Views: 551

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51093

Just as Daniel mentioned, it's not recommend to query information from TFS database directly. You can use TFS tf.exe merge command (also can be used in the PowerShell script).

tf merge /candidate /recursive BranchA  BranchB

This command will show you all the changesets that were made to BranchA but haven't been merged into BranchB.

Another option is to use the API to achieve your purpose.VersionControlServer has a property named GetMergeCandidates which returns an array of MergeCandidate which has the changeset and if it has been partially merged already as properties. Here is also a similar question TFS: List changesets that have not been merged for your reference

Upvotes: 1

Related Questions