TFS query (in Visual Studio) to get all check-ins

38,004

Solution 1

Just open the Team Explorer window, expand the TFS project, and double-click the Source Control node there.

Then you can simply right-click a project or directory in TFS source control and select View History, then you'll get all the commits.

Solution 2

The tf command-line utility (available via VS2010 Command Prompt) provides a way to retrieve the history of all checkins for a specified file or folder.

Specifically, the tf history command allows for filtering by date range. For example, to get all of the checkins for the current month of June (i.e. 6/1/11 - 6/30/11), then use the \version parameter with the date option (D"[start date]"~"[end date]"):

tf history c:\MyProject /recursive /version:D"06/1/11"~D"06/30/11"

This will launch an interactive GUI window showing all checkins that occurred between those dates. The GUI window is equivalent to the history windows shown in Visual Studio. Therefore, you can drill down to view changeset details, compare to files to previous versions, etc.

If you simply want to view the history list without the GUI window then add the parameter /noprompt:

tf history c:\MyProject /recursive /version:D"06/1/11"~D"06/30/11" /noprompt

This will output the results to the command prompt console window.

Solution 3

USE TfsVersionControl    

select distinct top 100 c.CreationDate,c.Comment,u.DisplayName, v.Fullpath
from tbl_changeset as c
 join tbl_identity as u on u.Identityid = c.OwnerId
 join dbo.tbl_Version as v on v.Versionfrom = c.ChangeSetId 
Order by c.CreationDate desc

Here is sql report I made to view recent changes.

Solution 4

Here is what we use

USE [Tfs_DefaultCollection]   

SELECT distinct cs.CreationDate, cs.[ChangeSetId], c.DisplayPart, cs.[Comment] 
from [tbl_ChangeSet] AS cs 
left outer JOIN [tbl_Identity] AS i ON cs.[OwnerId] = i.[IdentityId] 
left outer JOIN [Constants] AS c ON i.[TeamFoundationId] = c.[TeamFoundationId] 
left outer join dbo.tbl_Version as v on v.Versionfrom = cs.ChangeSetId 
WHERE creationdate > '04/12/2012' 
and (v.fullpath like '%\Web%' 
or v.FullPath like '%\Databases%')
ORDER BY cs.[CreationDate] desc

Solution 5

Check out TFS Sidekick from Attrice. It is a very nice and free tool that I use regularly. It has a history sidekick that allows you to query changesets by user on the source tree node that you select on the left handside of the UI. You can sort the results by date. You can also right click on a changeset to see the details such the files and the workitems.

Share:
38,004
user3199001
Author by

user3199001

WordPress, UX, e-commerce & photo freelance. Running the adventure brand Sten. Working as a teacher.

Updated on April 18, 2020

Comments

  • user3199001
    user3199001 about 4 years

    I'm trying to get a list of all check-ins (limited / ordered by date) via the TFS query editor in Visual Studio Team Explorer.

    I can make a query that lists all bugs, sprint backlog item or product backlog item, but I can't find the actual check-in. Is it's possible or should I make (SQL) queries directly on the database.

    Ideas?