我想以编程方式查明工作区是否有最新文件。我不想执行 Workspace.Get()
,因为这相当于执行“Get Latest”。我只想知道我的工作区是否需要“获取最新”。
我在构建期间进行此检查。我计划采用如下方法:
public static bool HasLatestFiles(Workspace ws)
{
bool hasChanges = false;
/* need correct code to query if ws has latest files */
return hasChanges;
}
正确的代码是什么?
最佳答案
使用 Workspace.Get(LatestVersionSpec.Instance, GetOptions.Preview)
然后检查由 Get
操作产生的 GetStatus.NoActionNeeded
.
所以:
public static bool HasLatestFiles(Workspace ws)
{
GetStatus result = ws.Get(LatestVersionSpec.Instance, GetOptions.Preview);
bool hasLatestFiles = result.NoActionNeeded;
return hasLatestFiles;
}
关于c# - 使用 TFS Api 查询我的工作区是否有最新文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26558654/