Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there an easy way to get a file and have the last check-in as the file's timestamp?

Tags:

msbuild

tfs

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 to 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?

like image 903
jcollum Avatar asked Jan 20 '10 16:01

jcollum


People also ask

What is last accessed date?

The last access date stamp refers to just about any activity that a user or even the computer system itself might do to a file. Anything that might update a file's last modified or creation dates, for instance, will generally also update the last access date.

What is last access timestamp?

Last access timestamp of a file is the last date and time when that file was opened for reading or writing. So every time a user access a file this timestamp needs to be updated, which is a bit of an overhead especially if you are not too keen on this file attribute.


2 Answers

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.

like image 158
Martin Woodward Avatar answered Nov 12 '22 20:11

Martin Woodward


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.

like image 28
weir Avatar answered Nov 12 '22 19:11

weir