简体   繁体   中英

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

通常,您只需指定映射到本地TFS工作区的项目的路径,例如:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM