简体   繁体   English

如果项目没有改变,如何在 tfs 上检测

[英]How detect on tfs if project doesn't change

I have local TFS2012.我有本地 TFS2012。 How can I detect, If was been any changes in Project or not?我如何检测项目是否有任何更改? I need this variable to decide in powershell script: deploy package on not.我需要这个变量在 powershell 脚本中决定:不部署包。

If you want to look to see if any specific files have changed you can View History of a specific folder and look at the dates on changesets.如果您想查看任何特定文件是否已更改,您可以查看特定文件夹的历史记录并查看变更集上的日期。 This can also be done programmatically using the TFS API.这也可以使用 TFS API 以编程方式完成。

Programmatically you can get the history of the project root using tf.exe:以编程方式,您可以使用 tf.exe 获取项目根目录的历史记录:

tf history . /stopafter:1 /format:brief /noprompt

Note: the ' .注意: ' . ' is just using the current location mapped to a TFS location, you would probably use $/Some/branch/location instead of ' . ' 只是使用映射到 TFS 位置的当前位置,您可能会使用$/Some/branch/location而不是 ' . ' '

The output will need to be parsed to get the date field需要解析输出以获取日期字段

Changeset Change                     User              Date       Comment
--------- -------------------------- ----------------- ---------- -------------
375564    merge                      developer    (... 8/24/2010  Merge comment

you can get the full set of tf history options by running tf history /?您可以通过运行 tf history /?

another way would be to try and get latest, if you get anything there was a change:另一种方法是尝试获取最新信息,如果您得到任何信息,则有变化:

tf get . /preview /noprompt /recursive

returns:返回:

Getting somefile.cpp
Getting someotherfile.cs
:
:

I'm working on only generating nuget packages for changed projects so I needed to figure out changed files.我只为更改的项目生成 nuget 包,所以我需要找出更改的文件。 Once you have the changed files you can search for projects that contain (or are) those changed items (files/folders):拥有更改的文件后,您可以搜索包含(或正在)这些更改项(文件/文件夹)的项目:

. . "$tf" diff . "$tf" 差异。 /noprompt /format:brief /version:D"$($lastBuildstartTime.ToString())"~W /recursive |? /noprompt /format:brief /version:D"$($lastBuildstartTime.ToString())"~W /recursive |? {$_ -like " only " -or $_ -like " differ "} {$_ -like " only " -or $_ -like " different "}

Hope that helps!希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM