Using TFS TF History to determine the latest changeset

Joan Arc picture Joan Arc · Apr 26, 2012 · Viewed 11.6k times · Source

I'm writing a script that will run a build only if there is a change in source code. I need to know whether there is a change since the build last ran. This used to work because the folder would not be deleted, so it was easy to determine whether there was a change, but now everything is deleted everytime the build is run. I thought about using the TFS TF history command to query the last changeset or the last two changesets, but have had issues parsing just the changeset number from the output. I also considered using the changeset command. Is there any command-line parameter that I can use to answer the question, has there been a change since either a date, or a changeset number?

Answer

Guanghui Qin picture Guanghui Qin · Apr 24, 2015

To the latest changeset number without local workspace, please use this command:

tf history /collection:"http://server:8080/tfs/Collection" "$/Project" /recursive /stopafter:1 /noprompt /login:domain\user,password