简体   繁体   中英

How to link TFS 2015 Changeset to Code Review in a SQL SELECT

Using either the Tfs_Warehouse.dbo.DimWorkItem (with System_WorkItemType = 'Code Review Request') and Tfs_Warehouse.dbo.DimChangeset tables, or the .CodeReview.tbl* and .dbo.tbl_ChangeSet tables, or some combination of those, what joins do I need in a SQL SELECT statement to relate a Changeset to the Code Review for that Changeset (assuming that one exists)?

I had this figured out for TFS 2012, but that query no longer works in 2015 due to the data model differences.

We don't recommend query database directly. Instead, we suggest you use TFS REST API to query information.

As we know, field Microsoft.VSTS.CodeReview.Context records the changeset number, so you can get a list of Code Review Request with field Microsoft.VSTS.CodeReview.Context . The request looks like:

Get http(s)://{instance}/DefaultCollection/_apis/wit/workitems?ids=xx,xx&fields=Microsoft.VSTS.CodeReview.Context&api-version=1.0

By the way, you can get IDs Code Review Request by running a query below:

POST http(s)://{instance}/DefaultCollection/_apis/wit/wiql?api-version=1.0
Content-Type: application/json
{
  "query": "Select [System.Id], [System.Title] From WorkItems Where [System.WorkItemType] = 'Code Review Request'"
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM