views:

456

answers:

4

I need a version control system that works like Subversion but is able to keep the 'modified' timestamp (date) of each file.

We need to version our setup projects. In this case it is imporatant that the input files (dll/exe's) keep their timestamp.

What is the best tool to do this? (OS: Windows)

Updated:

Here's an example of what I would like it to do:

  • put "foo.dll" (modified 1/1/2009) and "bar.dll" (modified 2/2/2009) into the working directory
  • create/test the setup and do a single commit
  • when another developer checks out the project both foo.dll and bar.dll should have their orginal modified date (1/1/2009 and 2/2/2009)

Our current workaround is to zip each dll (the modified date is kept in the zip) but I would prefer something easier.

+1  A: 

In git, a "commit" points to a single tree, marking it as what the project looked like at a certain point in time. It contains meta-information about that point in time, such as a timestamp, the author of the changes since the last commit, a pointer to the previous commit(s), etc.

Nerdling
I guess most version control systems provide this?
Hemal Pandya
Can it store the timestamp of each file?
chris
A: 

This is one of those requests that the subversion developers have on the radar, but have not yet implemented. As 'Nerdling' suggests, git or mercurial might be a better option, but you have a couple options in Subversion (since you are looking for something like SVN):

  1. There was a discussion and perl script on the SVN website that had some workarounds. It preserved the modified date on the initial commit... thereafter, it uses the commit time, but you could probably modify the script to use the modified time. It is perl, so your mileage on Windows may vary (I've not used cygwin and/or perl on windows): http://svn.haxx.se/users/archive-2006-10/1345.shtml

  2. You can change the svn:date property of each revision after the commit to match the modified time. This will change the modified time of every file in the commit, though, so if that's undesirable, be sure to commit the binaries on their own: http://svnbook.red-bean.com/en/1.5/svn.ref.properties.html and http://svnbook.red-bean.com/en/1.5/svn.advanced.props.html

  3. I think Tortoise SVN on windows may have some options to handle setting the date property on a commit. I've only heard this rumour, and not used it, so this is hearsay :-)

None of these are particularly elegant, and require some extra effort on your part, but they will work if you want to stick with SVN, which is certainly a good product. If you decide to explore another SCM like git or mercurial, note that you CAN use them just like SVN and ignore their other features to help ease the transition.

Jarret Hardie
Thanks - your first solutions might actually work but we have hundreds of files and if I do a commit for each one of them it will get really messy.
chris
In that case, you may which to write a custom script (perhaps a variant of the perl script above) to look for binary files in your commit by file type, and then have the script set the svn:date for them. You can tie this script to the SVN post_commit hook so it runs automatically after each commit.
Jarret Hardie
+1  A: 

Subversion has use-commit-times option which makes local copy use timestamps of last commit time of every file. Also svn export always sets last commit time.

Tometzky
Unfortunately this would set the modified time to the date of the commit instead of keeping the original timestamp.
chris
+1  A: 

You can try to use an own defined subversion property to store the timestamp. if you change this timestamp you have a "changed" state of the file and can commit it. you can access the contents of the properties by using the commandline. Also you have different times of each file.

However, you may need some minor additional scripts to set/read the properties

Peter Parker