tfstfs-2012

How detect on tfs if project doesn't change


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.


Solution

  • 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
    :
    :