Changing Subversion revision times

Occasionally revision entries in Subversion will not have a time/date included in the entry.  In my experience they are not entered when filtering information from other repositories or converting other types of version control data to Subversion.  If you are using Apache2 to handle the authentication errors will appear on the server's /var/log/httpd/error_log that look like this one:

[Thu Jan 13 07:31:32 2011] [error] [client] Could not access revision times.  [500, #0]

*Note* This only appears to be an issue for users and systems that use SVNKit as their Subversion client as most people will still be able to connect with Eclipse and other clients to check in data.  Hudson will usually have the most problems with this.

In order to correct the problem the entries with the missing dates will need to be located.  This is easily done with the following command string which needs to be run on the Subversion server itself.

svn log --xml -v -r {2010-12-01T00:00:00Z}:{2011-01-13T15:00:00Z} file:///svn/repo

If there is any issue related to the time on a revision then the following error will be shown when you run the above command.

<?xml version="1.0"?>


svn: Failed to find time on revision 34534

The first step in making the necessary corrections is to edit the /svn/repos/mosaic/hooks/post-revprop-change file so that it contains the following information.

exit 0

If the previous steps had not be performed the hook files would have prevented this step from actually occurring. So to make the change to the revision entry the svn command is used on the server itself using the propset subcommand. When entering the date try to select a date that is in between the dates that proceed and follow this revision entry.

svn propset -r34534 --revprop svn:date '2010-11-29T19:55:44.000220Z' file:///svn/repo

If the command is successful then following message will appear.

property 'svn:date' set on repository revision 34534

After that re-run the svn log command to verify there are no further entries that will cause errors. If there are none that the Subversion server are registering then you should see all of the log entries for that time period displayed.  This is not always a positive indication. It has been my experience that Subversion does not always register an error for all missing date entries. The best way to find out if there are any missing date entries is to copy the output of the svn log command to a searchable text document where <date></date> can be searched for.  If there are no other missing dates in the log then the final steps are to reverse the changes made to hook files and return them to their previous state

1 comment: