How can I keep the original file [commit] timestamp on Subversion?

SvnDatetimeTimestamp

Svn Problem Overview


I want to be sure that if I commit something in Subversion from one machine, and I checkout on another, I will get the same value for datetime and timestamp.

Currently, I observed that the datetime of file's modification is from the moment when I did the synchronisation instead of the original value.

For me, it doesn't make any sense to know when the files were synchronised - I just want to see the last commit time.

This issue is not timezone related.

Svn Solutions


Solution 1 - Svn

You can set it in .subversion/config:

[miscellany]
use-commit-times = yes

Although you will have strange side effects if we are talking about source files.

For example, you build your software and do svn update. Now the timestamp of the updated files is older than the timestamp of the build result file, and it won't be rebuilt even though some source files changed. Be very careful with this setting.

Solution 2 - Svn

If you are using TortoiseSVN, there is an option. TortoiseSVN -> Settings -> General -> "Set file dates to the 'last commit time'".

Right click on your Tortoise shortcut to settings

Solution 3 - Svn

Subversion doesn't preserve the original timestamp of the file.

If you absolutely need to preserve the timestamp, you have to do it yourself. For example, you could store the original timestamp as a Subversion property.

Solution 4 - Svn

It would seem 'stat -c %y $FILE' be used as part of a pre-revprop-change hook that operates on svn:date. Only issue I might see is the date format.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsorinView Question on Stackoverflow
Solution 1 - SvnsilkView Answer on Stackoverflow
Solution 2 - SvnnickfView Answer on Stackoverflow
Solution 3 - SvnoefeView Answer on Stackoverflow
Solution 4 - SvnImpressTheNet Web DeveloperView Answer on Stackoverflow