views:

360

answers:

3

Is there some way how to commit into the SVN repository with old time / date or how to edit the time / date post commit?

I have some archived sources which are very old, way before I have started using SVN, and I would now like to put them into the SVN and if possible to preserve their original date, so that SVN history matches the real date where files were edited.

Manipulating SVN server time is an obvious option, but it cannot be used here, as the SVN server is out of my control.

+1  A: 

Each revision has a property, svn:date. If you have permission to modify unversioned properties, you can change that value.

Dingo
+3  A: 

The date and time is in the "special" revision property, svn:date. You can modify it as so:

svn propedit svn:date --revprop -r 12345

or:

svn propset svn:date --revprop -r 12345 2009-02-12T00:44:04.921324Z

The revision (e.g. 12345 above) can also be HEAD meaning the latest revision.

The date is specified in ISO 8601 format.

You will need the repository to have the appropriate pre-revprop-change hook set up (in the hook directory in the repository) to allow svn:date to be modified. The templates that are provided with SVN repositories should be helpful.

Craig McQueen
+1  A: 

What I did eventually was:

  • install VisualSVN server on my workstation
  • create a new "local" SVN repository
  • take archives one by one, for each:
    • in the working copy delete everything but .svn file, to make sure files which were deleted are not left over
    • decompress the archive into the working copy
    • change system date to the date of the archive
    • add and delete as necessary and commit into the local repository
  • once done, use svnadmin dump the repository
  • on the main SVN server load the dump using svnadmin load

The steps above seem easier to me than installing the pre-revprop-change hook. (The one we currently have in place allows editing log message only.)

Note: instead of changing system date it would be also possible to edit the date in the dump file before loading it.

Suma
You can edit the dump file as long as your editor preserves any binary information and doesn't change the end-of-lines.
Dingo