【问题标题】:PowerTools Update-TfsWorkspace does not get latestPowerTools Update-TfsWorkspace 没有得到最新的
【发布时间】:2016-08-11 23:24:54
【问题描述】:

我正在尝试使用 PowerTools Update-TfsWorkspace,但正如标题所示,它不起作用。

例如,我有一位同事将文件检查到 $/Contoso/Dev/Test 中。在源代码管理中,我可以看到它呈灰色显示,表明虽然它在那里,但我没有下载它。所以我做了以下事情。

C:\TFS\Contoso\Dev> Update-TfsWorkspace -All -Overwrite -Force -Recurse -Item .\Test

命令立即执行并且什么也不做。没有错误输出或任何东西。而且它不是最新的。如果我进入 VS 源代码控制并手动获取最新版本,它会抓取预期的文件,但理想情况下它应该告诉我所有文件都是最新的。是否有人成功使用此 cmdlet 或使用 PowerTools 从 Powershell 执行 Get Latest 操作?

【问题讨论】:

    标签: powershell tfs tfs-power-tools


    【解决方案1】:

    Update-TfsWorkspace 应在 powershell 脚本或 powershell cmdlet 中使用。如果您有多个工作区,则可能无法正常工作。

    试试下面的方法:

    $tfsCredential = Get-Credential;
    $tfsServer = Get-TfsServer -Name "https://tfs.xxx.com:443/tfs/teamproject" -Credential $tfsCredential;;
    $tfsws = Get-TfsWorkspace -Server $tfsServer -Computer $hostname -Owner $tfsCredential.UserName;
    $tfsPath = $tfsws.GetServerItemForLocalItem($filename);
    $prop = Get-TfsItemProperty -Item $tfsPath -Server $tfsServer -Workspace $script:tfsws;
    $tfsws.Get(@($tfsPath), [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Parse($prop.VersionLatest,     $script:tfsws.OwnerName)[0], [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::Full, [Microsoft.TeamFoundation.VersionControl.Client.GetOptions]::None)
    

    此外,要更新工作区,您可以直接使用tf get command。如:

    C:\TFS\Contoso\Dev> tf get itemspec .\Test /noprompt
    

    【讨论】:

    • 我在多个工作区工作。解决方案是将cd 放入映射文件夹和tf gettf workfold 帮助查看了映射。
    猜你喜欢
    • 1970-01-01
    • 2014-08-07
    • 1970-01-01
    • 2012-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-11
    相关资源
    最近更新 更多