I'd like to get a batch of files from a directory by date except for one file. I'd like to then look at all the files and see that yes, files 1 t开发者_如何学Goo n are the old versions and file 0 is the new version.
The simplest way to do that, seems to me, is to get the files and have the local file's timestamp be the last checkin time of that file. However, I don't think that's possible in TFS without custom coding. Is there an easy way to do this?
In current version of TFS (including TFS 2010), the files timestamps are always the time that they were downloaded by doing the get.
Don't quite understand the reason behind what you are trying to do, but it sounds like the easiest thing would be for you to write a simple .NET class or powershell script that did what you needed using the VersionControl part of the TFS API. You'd be able to query last-check-in dates etc without even haveing to download the file in question - you'd just look at the changeset ID's of each file to see which is the newest.
Yes, there is in easy way to do this if you are using at least TFS 2012 and Visual Studio 2012. From the Visual Studio documentation on advanced workspace options:
File Time:
Choose Checkin if you want the date and time stamp of each file to generally match the stamp of the changeset of the version in your workspace. A few issues and exceptions are:
When you modify the local file, the date and time stamp will match the date and time when you modified the file.
This feature is available only if you are using Visual Studio 2012 or later and Visual Studio Team Foundation Server 2012 or later.
The setting does not apply to folders, unless there is a pending add or delete operation to a file contained by the folder.
You might not be able to build your code project incrementally. Instead, you will have to rebuild).
Choose Current if you want the date and time stamp to match the date and time when you last modified the local file. For example, a team member checked in the latest change to the file on Monday. On Tuesday, you perform a get operation to update the file. The date and time stamp is set to Tuesday.
精彩评论