I’m working on a project where I need to get all the changesets for a specific branch from our TFS Warehouse. I’ve got a basic query that pulls changesets, but I can’t figure out how to filter it by branch. Here’s what I’ve got so far:
SELECT ChangesetID, Title, UpdatedDate, Author
FROM WarehouseDB.Changesets
WHERE UpdatedDate > '2023-01-01'
This gives me recent changesets, but how do I narrow it down to a particular branch? I’ve looked through the database schema and can’t find anything that looks like it represents branches. Any ideas on how to modify this query to get branch-specific data? Or am I missing something about how branches are stored in the warehouse?
Regarding your query about branch-specific changesets in TFS Warehouse, you’ll need to join a few tables to get the desired results. The key is to use the VersionControl.Branches and VersionControl.BranchToChangeset tables in conjunction with your existing query. Here’s a modified version that should work:
SELECT c.ChangesetID, c.Title, c.UpdatedDate, c.Author, b.BranchName
FROM WarehouseDB.Changesets c
JOIN VersionControl.BranchToChangeset btc ON c.ChangesetID = btc.ChangesetID
JOIN VersionControl.Branches b ON btc.BranchID = b.BranchID
WHERE c.UpdatedDate > '2023-01-01'
AND b.BranchName = 'YourBranchNameHere'
This query joins the necessary tables and allows you to filter by branch name. Adjust ‘YourBranchNameHere’ to match the specific branch you’re interested in. Remember, the exact table names might vary slightly depending on your TFS version, so you may need to tweak them accordingly.
hey there! branches in TFS warehouse can be tricky. have u checked the VersionControl.Branches table? it might have wat ur looking for. also, try joining with VersionControl.BranchToChangeset to link changesets to specific branches. hope this helps u out!