tags:

views:

7662

answers:

8

Is there a way to edit the commit message of a certain revision in Subversion? I accidentally wrote a wrong filename in my commit message which could be confusing later.

I've seen How do I edit an incorrect commit message in git but the solution to that doesn't seem to be similar for Subversion (according to svn help commit).

+22  A: 

See this part of the Subversion FAQ

Kamil Kisiel
As of Feb. 3, 2010, the URL is http://subversion.apache.org/faq.html#change-log-msg
GreenMatt
Thanks, adjusted the link.
Kamil Kisiel
+3  A: 
svnadmin setlog /path/to/repository -r revision_number --bypass-hooks message_file.txt
nickf
I'm using Google Code so I don't think I can do it this way, but thanks.
yjerem
this worked for me as the propedit method failed with "Repository has not been enabled to accept revision propchanges". thanks!
pfctdayelise
+4  A: 

Check the Subversion FAQ:

How do I change the log message for a revision after it's been committed?

Rob Kennedy
+3  A: 

If your repository enables setting revision properties via the pre-revprop-change hook you can change log messages much easier.

svn propedit --revprop -r 1234 url://to/repository

Or in TortoiseSVN, AnkhSVN and probably many other subversion clients by right clicking on a log entry and then 'change log message'.

Bert Huijben
in Subclipse (Eclipse) it is "Set Commit Properties".
pfctdayelise
A: 

Why would anyone want to change the reported log? Do you think that would make the commit tamper'able?

+3  A: 

@tet: We often see log messages that are incomplete, contain typos or contain information that gets outdated. In all these cases it helps future reviewers of changes to allow updating log messages.

In theory one can change logmessage for worse, but in practice I've only seen improvements. (I often extend logmessages when trying to determine when a bug was introduced)

Bert Huijben
Agreed. The "written once, read many times" principle can apply to commit messages as well as code.
TSomKes
+3  A: 

Here's a handy variation that I don't see mentioned in the faq. You can return the current message for editing by specifying a text editor.

svn propedit svn:log --revprop -r N --editor-cmd vim

mcqwerty
+3  A: 

When you run this command,

svn propedit svn:log --revprop -r NNN

and just in case you see this message:

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

Its because Subversion doesn’t allow you to modify log messages because they are unversioned and will be lost permanently.

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

Source

Alex. S.