如何在Powershell中使用TFS SnapIn“Add-TfsPendingChange -Edit”功能?

时间:2011-10-25 23:04:58

标签: powershell tfs automation

Powershell脚本目前包含:

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

在帮助文件和文档中,我没有找到如何正确填充<QualifiedItemSpec[]>开关的-Item参数。

这可以仅使用$filePath中的路径来完成,还是需要将此挂起的更改添加到更改集中,还是需要获取包含TFS工作空间的变量和包含的变量更改设置为将编辑附加到?

注意:这是一个函数,所以我想做相同的(忽略语法和类型失败):

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

此外,这些应保留为待处理编辑,以便我可以在通过VS完成签入之前在VisualStudio中检查这些文件

1 个答案:

答案 0 :(得分:6)

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

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