views:

278

answers:

4

I would like to re-write a big number of SVN commit messages to a different structure, e.g. prefix a category. From:

"foo" now accepts "bar" format for connection string.

I want

core - database - "foo" now accepts "bar" format for connection string.

Is there an easy way to do this that does not include dumping the whole repository using svndumpfilter?

I am working with TortoiseSVN on the client end, and VisualSVN on the server end. (VisualSVN is a wrapper around classic svn, which I can talk to through the command line as well.)

+2  A: 

Use svn propset on the svn:log property. Examples in the svn book.

jleedev
+1 Cheers @jleedev. I am accepting JesperE's answer because it's the quickest way to go about it in Tortoise.
Pekka
+11  A: 

Yes, commit messages can be changed. They are implemented as properties on revisions, similar to the regular file-properties.

In the TortoiseSVN Log window you can right click on a commit and select "Edit log message".

JesperE
+1 Thanks for this. I did some work involving some API changes that I wanted to commit separately to the rest, and I wrote the log message to reflect that... before accidentally committing the whole lot. I "fixed" it by committing a whitespace change with a log message that explained the rest! next time, I'll know what to do.
Ed Daniel
+6  A: 

You can certainly change log messages retroactively, it's covered in the FAQ. I'm not sure how the command line interface for VisualSVN works, but for vanilla svn the command would be

svn propset -r N --revprop svn:log "new log message" URL

If you want to do this for all revisions without dumping the repository and re-loading, you could script this command to work on a list of all revisions. It would take some time to do this way, depending on the size of your repository, but in principle there's no reason you can't do it, and it does not involve a dump and reload.

Also, vanilla SVN has a command svnlook which is sort of an administrative tool that works directly with the repository files. That tool doesn't understand URLs (you must have filesystem-level access to the repository), but is much faster. The syntax is a little different, but you can modify properties in the same way using that tool.

Adam Bellaire
+1 Thanks for the detailed answer. I am accepting JesperE's answer because he pointed out the simplest way available to me in my GUI. Yours is definitely the best way when working with vanilla svn.
Pekka
+2  A: 

Yes, you can, but you need to enable it on the repository first.

In the repository, in the hooks directory, is a file called pre-revprop-change.tmpl. It's got a couple of pages of comments on what it does, and comes set up to only allow changes to the log properties. To enable it, rename the file to pre-revprop-change and make it executable (I'm assuming a POSIX-hosted subversion, if you're using Windows to host, you might find this message useful).

Once the repository allows it, you can use Tortoise to change the log message for a commit from the right-click menu on a commit, or you can use the command line.

Andrew Aylett
+1 Excellent information sir. It won't let me do it without a pre-revprop-change hook. I'll have to port the template bash script to windows, but that shouldn't be a problem.
Pekka
I added a link to an example command script: http://svn.haxx.se/users/archive-2006-03/0107.shtml
Andrew Aylett