【发布时间】:2019-03-10 08:44:43
【问题描述】:
我是 TFS 的新手,出于管理目的,我正在尝试获取所有 TFS 工作区及其在 PowerShell 上本地计算机中的待定更改。
我知道您可以使用以下方法获取工作区:
tf vc workspaces
还有与待定更改类似的内容:
tf vc status
但是,我怎样才能获得每个工作区的待定更改?
谢谢。
【问题讨论】:
标签: powershell tfs
我是 TFS 的新手,出于管理目的,我正在尝试获取所有 TFS 工作区及其在 PowerShell 上本地计算机中的待定更改。
我知道您可以使用以下方法获取工作区:
tf vc workspaces
还有与待定更改类似的内容:
tf vc status
但是,我怎样才能获得每个工作区的待定更改?
谢谢。
【问题讨论】:
标签: powershell tfs
您可以使用下面的 PowerShell 脚本来获取每个工作区及其未决更改:
#Set-Alias tf "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe" #For VS 2017
Set-Alias tf "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TF.exe" #For Visual Studio 2015
Write-Host "Workspaces in current local machine:`n"
tf workspaces
Write-Host "`n`nPending changes for each workspace:"
ForEach ($workspace in tf workspaces | Foreach {"$(($_ -split '\s+',2)[0])"} | select-string -Pattern 'Collection:|Workspace|""|----------------' -NotMatch )
{
Write-Host "Workspace Name:" $workspace
tf status /workspace:$workspace
Write-Host `n
}
此外,您还可以使用工具Team Foundation Sidekicks 来管理工作区和待处理的更改...在另一个线程中参考我的答案:Visual studio 2017 Team foundation server question on checking whose working on what files
【讨论】: