11
votes

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.

3
Is this an existing repository, or a new one? Would you be overwriting directories and / or files in the repository?Pekka
An existing repository, in initial commit I will be overwriting no files, but some of them will be overwritten later. I have a bunch of archive files like sources-1995-05.zip, sources-1995-08.zip, sources-1996-01.zip and I would like to transfer their content to SVN and have dates like 1995/08/xx and 1996/01/xx with the respective commits.Suma

3 Answers

16
votes

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.

2
votes

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

1
votes

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.