How detect on tfs if project doesn't change

71 views Asked by At

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.

3

There are 3 answers

0
Chad Dienhart On BEST ANSWER

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
:
:
0
Dylan Smith On

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.

0
Brandon Hawbaker On

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!