Tuesday, January 6, 2009

Change SVN log error

I'm using Subversion and needed to change a revision property (in my case, the log message) of a particular revision of the code. When I tried to do it with TortoiseSVN (Show log > Right click on a revision > Edit Log Message), I got the following error message:

DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent

Basically, Subversion doesn't allow you to modify log messages because they are unversioned and will be lost permanently. They don't want you screwing things up by accident! Therefore, you have to set up a hook script that the Subversion server will invoke when you try to change the log message in TortoiseSVN. In the case of log messages, you need to set up a pre-revprop-change script. There are other 'hooks' such as post-commit which allows you to run some custom stuff after you've made a commit. These hooks are located in the hooks subdirectory of the Subversion repository directory on your server. Inside that directory, there are a bunch of template scripts (e.g. pre-revprop-change.tmpl) that can be modified to be used for your particular repository. If you're running the Subversion server on UNIX, setting up the pre-revprop-change script (so that log messages are allowed to be modified) can be done like this

  • Go to the hooks directory on your Subversion server (replace ~/svn/reponame with the directory of your repository)

cd ~/svn/reponame/hooks

  • Remove the extension

mv pre-revprop-change.tmpl pre-revprop-change

  • Make it executable (cannot do chmod +x!)

chmod 755 pre-revprop-change

Now try modifying the log message again.

No comments:

Google+