I have local 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.
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.
Programmatically you can get the history of the project root using 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 ' .
'
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 /?
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. Once you have the changed files you can search for projects that contain (or are) those changed items (files/folders):
. "$tf" diff . /noprompt /format:brief /version:D"$($lastBuildstartTime.ToString())"~W /recursive |? {$_ -like " only " -or $_ -like " differ "}
Hope that helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.