user1070202
user1070202

Reputation: 157

TFS Listing of all files and version numbers with a particular changeset

I'm new to TFS and needing to write a TSQL query to get a listing of all files and version numbers that were included in a particular changeset version number. While searching online for the tables to get this information I found some people mentioning to use the Tfs_Warehouse database and others that used the Tfs_DefaultCollection database. I have the following questions:

Upvotes: 7

Views: 5887

Answers (3)

Matt
Matt

Reputation: 1911

If you're looking to get this data from the SQL Server database, here is a query to get you started:

SELECT 
    chg_set.CreationDate,
    chg_set.ChangeSetId, 
    v.FullPath
FROM dbo.tbl_ChangeSet (nolock)AS chg_set 
    INNER JOIN dbo.tbl_Version (nolock)AS v ON chg_set.ChangeSetId = v.VersionFrom 
    LEFT OUTER JOIN dbo.tbl_File (nolock) AS f ON v.FileId = f.FileId
WHERE (chg_set.ChangeSetId = [Your changeset ID])
ORDER BY chg_set.CreationDate, v.FullPath

Source: http://taoffi.isosoft.org/post/2012/05/23/TFS-database-pause-Change-set-quantitative-statistics-sample

Upvotes: 9

granth
granth

Reputation: 8939

You can use the VersionControlServer.GetChangeset() method from the TFS Object Model.

You will need to add references to the following assemblies in the GAC:

  • Microsoft.TeamFoundation.Common
  • Microsoft.TeamFoundation.Client
  • Microsoft.TeamFoundation.VersionControl.Client

    Private Shared Sub Main(ByVal args As String())
        Dim tfs As TfsTeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(New Uri("http://tfsserver:8080/tfs/CollectionName"), New UICredentialsProvider)
        tfs.Connect(ConnectOptions.None)
        Dim vcs As VersionControlServer = tfs.GetService(Of VersionControlServer)
        Dim changeset As Changeset = vcs.GetChangeset(changeset ID, True, False)
    End Sub
    

Then you can inspect the .Changes property to see all the changes included in the Changeset.

Upvotes: 2

AakashM
AakashM

Reputation: 63338

Does tf.exe changeset not provide the information you want? It's got lots of options...

Upvotes: 0

Related Questions