views:

756

answers:

3

I know how to query workitems, although I haven't been very successful finding info on the WIQL. There's one basic example that seems to get repeated everywhere.

I'd like to be able to query changesets. Can I do it with tf.exe, tfpt.exe, or.. ?

+5  A: 

The October 2008 release of the TFS PowerTools has some cmdlets for working with change sets.

  • Add-TfsPendingChange
  • ConvertTo-FixedByte
  • ConvertTo-FixedPath
  • Get-TfsChangeset
  • Get-TfsChildItem
  • Get-TfsItemHistory
  • Get-TfsItemProperty
  • Get-TfsPendingChange
  • Get-TfsServer
  • Get-TfsShelveset
  • Get-TfsWorkspace
  • New-TfsChangeset
  • New-TfsShelveset
  • Remove-TfsPendingChange
  • Remove-TfsShelveset
  • Restore-TfsShelveset
  • Select-TfsItem
  • Set-TfsChangeset
  • Update-TfsWorkspace
Steven Murawski
+3  A: 

Get-TfsItemHistory is probably the one you want.

NAME
    Get-TfsItemHistory

SYNTAX
    Get-TfsItemHistory [-HistoryItem] <QualifiedItemSpec> [-Prompt] [-Recurse] [-Server
<TeamFoundationServer>] [-Slotmode] [-Stopafter <String>] [-User <String>] [-Version <String>]
[-All] [<CommonParameters>]

Use the -All parameter if you want to enumerate the Changes collection inside each changeset. Without -All the query is much faster, but only returns the changeset metadata.

See my blog for an explanation of QualifiedItemSpec.

If you can't use Powershell for whatever reason, regular old tf history can do almost everything Get-TfsItemHistory can. It's just harder to compose into scripts.

Richard Berg
thanks, I Don't know how I missed "tf.exe changeset" ????
Cheeso
A: 

Hi

I'm trying to get a list of only changed files using Get-TfsItemHistory (see below - which I found on the web). However, I'm having a few issues requires has the following syntax:

Get-TfsItemHistory [-HistoryItem] [-Prompt] [-Recurse] [-Server ] [-Slotmode] [-Stopafter ] [-User ] [-Version ] [-All] []

Could you give some examples of using Get-TfsItemHistory [-HistoryItem] parameter which is required?

Get-TfsItemHistory $/project -Version “D10/1/09~D11/12/09” -Recurse -IncludeItems | Select-Object -Expand “Changes” | Where-Object { ($.ChangeType -band ([Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Delete -bor [Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Merge -bor [Microsoft.TeamFoundation.VersionControl.Client.ChangeType]::Branch)) -eq 0 } | Select-TfsItem | Group-Object Path | Select-Object Name | Sort-Object*

Jas
open a new question.
Cheeso