StuperUser
StuperUser

Reputation: 10850

How to use TFS SnapIn "Add-TfsPendingChange -Edit" function in Powershell?

A Powershell script currently contains:

$filePath = "C:\someDir\someFile.ext"
Add-TfsPendingChange -Edit -Item <QualifiedItemSpec[]>

From the help files and documentation, I've not found how to populate the <QualifiedItemSpec[]> parameter for the -Item switch properly.

Can this be done using just the path in $filePath or do I need to add this pending change to a change set, or do I need to get a variable that contains the TFS work space and a variable that contains the change set to append an edit to?

Note: This is in a function, so I would want to do the equivalent of (ignoring the syntax and type failures):

function someFunction([string]$FileName, [TFSChangeSet]$ChangeSet)
{
    #lines of code
    $filePath = [string]::Format("C:\someDir\{1}.ext", $FileName) 
    $ChangeSet.Edit($filePath)
}

Also, these should remain as pending edits so I can inspect these files in VisualStudio before completing a checkin via VS

Upvotes: 4

Views: 2618

Answers (1)

Keith Hill
Keith Hill

Reputation: 201652

Normally you just specify a path to an item that is mapped into your local TFS workspace e.g.:

C:\Tfs\Acme\Trunk\Source> Add-TfsPendingChange -Edit Foo.sln

Upvotes: 6

Related Questions