Get Modified Date\Time  
Author Message
Juice Johnson





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

I am having a local DateTime issue with Team Source control.  When I get latest of changed files or get files for the first time, the local Date/Time of the file is the Date/Time that the file was downloaded. In Visual Source Safe it was a simple option to specify how the local Date/Time for a file should be determined. This isnt such a big deal for local dev machines, but its a huge deal when we start talking about Build Machines.

I work on a huge public website and our pre-TFS build process would only copy files to QA that had been modified.  Then from QA we would go to staging and then to production. The files that get moved from server to server were only changed files.

If I deploy(copy) the site to QA, every file is replaced on the QA server. This is bad but not as bad as the problem I run into when I have to replace files on Production.  We are talking about a huge public site here. I cant just replace every single file. I only need to move files over that have been modified. Is there anyway to have team build get the files from source control but ensure that the files have the date time that they were modified, not the Date/time when they were downloaded   This was a simple setting in Visual Source safe options, but I cant find that in TFS. 



Visual Studio Team System41  
 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

We don't have this feature in TFS. What you might want to do is use separate branches to represent Dev, QA, and Production. This allows you to move (promote) changes between them using the Merge Wizard. To handle your deployment scenario, you'd add a Team Build that only built in the Production branch.

 
 
Juice Johnson





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Thanks for the reply Richard. Im not sure If I understand your proposed solution because, even if I had a production branch and build, when the build runs and pulls files from the production branch, the files get pulled from source control with the current date and time. So now when the deployment process comes along and needs to move changed files over to production, how am I supposed to distinguish between the files that really changed versus the files that just had thier timestamp changed becuase it was retrieved from source control

I think this is a major problem and I am surprised that there aren't more complaints about it. Maybe most people dont have a problem with overwriting thier whole production site, but I just dont have that liberty.


 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

When you run Get from a workspace mapped to the Production branch, it should only fetch files that have changed since the previous Get. You can then only build files whose timestamps are >= the time of the previous Get.

An even better method would be to register for the Getting event in the client API. You could also parse the output of 'tf get /preview'.

 
 
Juice Johnson





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Richard, now I see what you are saying. The only problem with this is that it is workspace dependent. If the workspace were to get re-initialized for some reason, I would lose all of my timestamps. I guess this is my best solution though and I will just have to pray that I never need to reinitialize the workspace. I have figured out how to turn the re-initialization off in TFS build, so I should be good for now.

Are there any plans to remedy this situation in TFS or is there some reason why modfied timestamps were thought to be unimportant

Why would I want to register for the getting event What info could I find from the getting event that isnt available now

Thanks,

Jesse


 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Using an event handler would be more reliable in my mind, since you'd be getting the information directly from TFS instead of relying on the filesystem. Filesystem timestamps can vary for any number of reasons.

 
 
Juice Johnson





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

I'm not sure if I am following you here, are you saying that I can get the actual last date modified from TFS Could you point me in the direction of an article discussing how I could tap into these events thanks.

Jesse

 
 
Richard Berg MSFT





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Start with this sample: http://blogs.msdn.com/buckh/archive/2006/03/15/552288.aspx

The line versionControl.Getting += Example.OnGetting; registers an event handler for Getting. Once you set that up, any time your application runs Get, an event will fire for each file that's retrieved. If you record this info, you'll have everything you need to determine which files to rebuild & redeploy.

You can always retrieve the last modified time directly from the TFS database using VersionControlServer.GetItems() or the command line 'tf prop'.

 
 
Pavel Konev





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Hi, Jesse, just wanted to say that I also encountered the same behavior; and it's quite strange for me to see that a source control tool modifies timestamps of the files. I am working on a big software project and full rebuild takes long time. Now every time I get a specific label or just do a "force get", the build process does a full rebuild because all timestamps are modified. Previously I was able to move the build folder with *.obj files back into the tree and thus do an incremental build, and now I can't..

How did you finally solve you problem

Is anyone from Team System developers can comment about why this "feature" was changed from VSS and can it be fixed in the next version / service pack

Thanks in advance,

Pavel.


 
 
Saila





PostPosted: Team Foundation Server - Version Control, Get Modified Date\Time Top

Hi, I'm writing a small program which needs the "Date Modified" information. I use following lines in my program.

Dim information As System.IO.FileInfo

information = My.Computer.FileSystem.GetFileInfo(s)

d = information.CreationTime

It came out a CreationTime as # 12/31/1600 4:00:00 pm #. From Explorer, the "Date Modified" is 8/17/2007 2:38 PM.

.

Thanks.