Which VCS is capable of preserving file timestamps?
There is an extension to Mercurial that automatically saves file timestamps. I have tried it out and it seems to work well. In order to get it to work properly, you must do the following:
Download and install the extension.
Initialize the repository where you want to preserve timestamps, add the files, but don't commit yet.
Generate the timestamps file. I think you have to do this before you commit the file, but I haven't tried it both ways to be sure.
hg timestamp_mod -s
Do the initial commit to store the files in the repository with their proper timestamps.
Truly preserving the timestamp of each and every file is not an approach that scales well.
I should know, the one CVCS (Centralized VCS) which does this is... ClearCase! (see the checkin -ptime
option)
And it is sloooooow :)
Plus, as manojlds mentions, there is this thread against this idea for Git.
Still, there was a study, for SVN, for preserving timestamps:
Building with a Version Control Audit Trail from Alec Clews, with an example in github/svnbuilding.
And there was a similar study with github/gitbuilding.
In both case, it is about recording the information in a separate file, and even that wasn't about restoring dates and time...
So if you need this information:
a/ it better be for all the files you are putting in a VCS (especially a free one, or any DVCS)
b/ you could, with Git:
- make your commit
- then, for the relevant files, add the timestamps information with git notes (which is able to add any kind of metadata you want on top of any commit, without changing the SHA1s)
This would be a bad idea for a VCS, there may be some valid use cases for some - but they'll be really obscure and not software related. All VCS systems keep track of this metadata, and your build script could query it and then backdate your files.
Out of curiosity, why would you want to do such a thing? I think expounding on the problem you have and asking for a solution will yield you better results than asking how to implement the one solution you've seized on.