TF.exe相当于TFPT.exe scorch

时间:2013-12-05 16:46:21

标签: tfs tfs-power-tools tf-cli

我一直在寻找相当于git reset的TF.exe命令行。 我找到了TFPT scorch,但这是用于构建服务器(jenkins),我似乎无法安装电动工具(以标准方式)或工作(非标准,复制)。

有吗

  1. 在构建服务器上安装tfpt.exe的方法(不能,也不能有Visual Studio)?
  2. 使用TF.exe命令集合模拟此命令的方法吗?

4 个答案:

答案 0 :(得分:20)

您没有指定您正在使用的TFS版本。但是,有一个等价物:tf reconcile /clean

根据tf文档:

Microsoft (R) TF - Team Foundation Version Control Tool, Version 12.0.30501.0
Copyright (c) Microsoft Corporation.  All rights reserved.

Compares the current state of the workspace on disk with the server's view,
either to clean the workspace or to promote unpended local changes.

tf reconcile /clean [/diff] [/noprompt] [/preview] [/recursive] [/ignore]
             [/unmapped] [/exclude:itemspec1,itemspec2,...] [itemspec]

tf reconcile /promote [/adds] [/deletes] [/diff] [/noprompt] [/preview]
             [/recursive] [/noignore] [/exclude:itemspec1,itemspec2,...]
             [itemspec]

运行: tf reconcile /clean /diff /noprompt /recursive *.*

相当于: tfpt scorch *.* /noprompt /recursive /deletes /diff

有趣的是,current tf.exe documentation中没有此命令。

另外,正如@Jonathan所提到的,现在还有一个tf scorch命令,它与tf reconcile非常相似。如果存在差异,我找不到备份文档。它很可能与使用本地与服务器工作区有关,该工作区于2013年添加,以允许真正的"离线"发展。

答案 1 :(得分:2)

我在构建代理安装脚本中自动安装TFPT:

msiexec /qb /i "tfpt.msi" ADDLOCAL=CLI /l*v tfpt-log.log

然后使用TFSPowerToolDir env var轻松找到它。 更新:这需要Visual Studio - 我安装了它的一部分,只有vs_teamExplorer.exevstf_testagent.exe

此外,tf.exe现在也有/scorch选项。它在VS2013中不存在,但它在VS2013 SP4中存在。

答案 2 :(得分:1)

我刚刚在构建过程结束时添加了一个删除文件任务,其中**作为参数。因此,每个构建都应该从头开始获取最新版本,而不必担心可能未提前在代理上正确安装的TFS实用程序。这个解决方案对我来说似乎更简单。

答案 3 :(得分:0)

如果您愿意编写自己的“scorch”功能,则可以针对TFS Java SDK执行此操作,这不需要您安装Visual Studio。

scorch背后的基本机制是获取工作区版本中的项目列表和具有挂起更改的项目列表,将其与磁盘上的项目列表进行比较,删除磁盘上的任何项目不在服务器上(或有待更改)。

(您需要将一组服务器项与一组待处理的更改结合起来,以避免删除待处理的添加。但是,如果您希望为构建服务器提供此特殊功能,并且您永远不会有待处理的更改,请随意省略此步骤。)

您可以使用工作区版本中的Workspace.QueryItems收集服务器上的项目列表。