得到的git像統計數據我一直在TFS工作了幾個月了,想了解一些基本的統計數據,讓他們提供給我們的團隊。在git的,我可以檢索「作者提交」和「按日期承諾」等統計如何從TFS
我想從TFS顯示出類似的統計(或TeamCity的)。
這可能嗎?
得到的git像統計數據我一直在TFS工作了幾個月了,想了解一些基本的統計數據,讓他們提供給我們的團隊。在git的,我可以檢索「作者提交」和「按日期承諾」等統計如何從TFS
我想從TFS顯示出類似的統計(或TeamCity的)。
這可能嗎?
我發現,在「源」選項卡下的Visual Studio團隊系統Web訪問的改變設置視圖。選擇所需項目並從項目下拉菜單中選擇版本歷史記錄。
這足以滿足我的需求。
您可以使用TFS API來創建你喜歡的任何疑問。您可以通過變更很容易重複某個作者尋找所有提交,或在某一特定日期提交:
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/"));
tpc.EnsureAuthenticated();
VersionControlServer vcs = tpc.GetService<VersionControlServer>();
int latest = vcs.GetLatestChangesetId();
DateTime earliestDate = new DateTime(2011, 1, 1);
do
{
var changeset = vcs.GetChangeset(latest);
if (changeset.CreationDate < earliestDate)
{
break;
}
// do analysis of the changeset here,
// e.g. use changeset.Committer or changeset.Changes
} while (latest-- > 0);
Here你可以找到你可以在TFS數據庫上運行來獲得一些統計數據的一些疑問。
-- Change this to the name of your collection DB. You’ll need to run these queries for each of your collection DBs.
USE Tfs_DefaultCollection
GO
-- Recent Users
select count(distinct IdentityName) as [Recent Users] from tbl_Command with (nolock)
-- Users with Assigned Work Items
select count(distinct [System.AssignedTo]) AS [Users with Assigned Work Items] from WorkItemsAreUsed with (nolock)
-- Version Control Users
select COUNT(*) AS [Version Control Users] from [Tfs_Configuration].[dbo].tbl_security_identity_cache as ic JOIN tbl_Identity as i ON i.TeamFoundationId=ic.tf_id where ic.is_group = 0
-- Total Work Items
select count(*) AS [Total Work Items] from WorkItemsAreUsed with (nolock)
-- Areas and Iterations
select count(*) AS [Areas and Iterations] from tbl_nodes with (nolock)
-- Work Item Versions
select count(*) AS [Work Item Versions] from (select [System.Id] from WorkItemsAreUsed with (nolock) union all select [System.Id] from WorkItemsWereUsed with (nolock)) x
-- Work Item Attachments
select count(*) AS [Work Item Attachments] from WorkItemFiles with (nolock) where FldID = 50
-- Work Item Queries
select count(*) AS [Work Item Queries] from QueryItems with (nolock)
-- Files
select count(*) as [Files] from tbl_VersionedItem vi with (nolock) join tbl_Version v with (nolock) on v.ItemId = vi.ItemId where VersionTo = 2147483647
-- Compressed File Sizes
select (sum(convert(bigint,OffsetTo - OffsetFrom + 1))/(1024 * 1024)) AS [Compressed File Sizes] from tbl_Content with (nolock)
-- Uncompressed File Sizes
select (sum(FileLength)/(1024 * 1024)) AS [Uncompressed File Sizes] from tbl_File with (nolock)
-- Checkins
select max(ChangeSetId) AS [Checkins] from tbl_ChangeSet with (nolock)
-- Shelvesets
select COUNT(*) AS [Shelvesets] from tbl_Workspace with (nolock) where type='1'
-- Merge History
select SUM(st.row_count) AS [Merge History] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_MergeHistory' AND (index_id < 2)
-- Pending Changes
select count(*) AS [Pending Changes] from tbl_PendingChange pc with (nolock) join tbl_Workspace w with (nolock) on pc.WorkspaceId = w.WorkspaceId where w.Type = 0
-- Workspaces
select COUNT(*) AS [Workspaces] from tbl_Workspace with (nolock) where type='0'
-- Local Copies
select SUM(st.row_count) AS [Local Copies] from sys.dm_db_partition_stats st WHERE object_name(object_id) = 'tbl_LocalVersion' AND (index_id < 2)
-- Command Counts
select Command, count(*) as [Execution Count] from tbl_Command with (nolock) WHERE Command IN ('QueryWorkitems', 'Update', 'GetWorkItem', 'Get', 'VCDownloadHandler', 'Checkin', 'Upload', 'Shelve') GROUP BY Command, Application ORDER BY [Application],[Command]
有一個TFS Performance Report Pack,這將給你的信息,但它不是你要求
我在TFS統計中找到最簡單的方法是使用Excel報告 - 您可以在幾乎任何您想象的數據上進行調整。對於指導入門看看這篇博客我寫:
http://www.woodwardweb.com/vsts/getting_started.html
TFS提供了讓你深入到正規庫數據的頂部全數據倉庫。